Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying record data to another record!

Status
Not open for further replies.

dhshaikh

Technical User
Jun 19, 2003
9
GB
Hi,

I have a database (Access 97) which has a form that displays a number of records using text boxes, subforms and tabsheets.

I was wondering if it was possible to make it so that if a user needs to duplicate all the info on a certain record onto another one, then they can maybe tick a box on the child record and this child record will then always have the values of the parent record.

I suppose as well as ticking a box on the child record, the user will also enter the ID Number of the master record (which will be a unique record) so it know where to link to.

I have a feeling this needs some coding but am not that good at writing code apart from basic if statements and stuff.

Any help would be greatly appreciated. Sorry if it doesn't make sense (its tricky to explain).

 
If you are fine with coding it, you could so something like this (I use this for variables which need to remain the same for a number of records):
Code:
Dim strText1 as String
Dim strText2 as String
Dim strText3 as String

strText1 = txtText1
strText2 = txtText2
strText3 = txtTest3

DoCmd.GoToRecord , , acNewRecord

I assume you would put it in a conditional statement, something like this:
[CODE]
If chkCheckBox1 = 1 Then
   Run code as above
End If
txtText1 = strText1
txtText2 = strText2
txtText3 = strText3
[/CODE]


Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Ooops.. dag nab dem dar typos!!! [WINK]

Same Post, but corrected:

If you are fine with coding it, you could so something like this (I use this for variables which need to remain the same for a number of records):

Code:
Dim strText1 as String
Dim strText2 as String
Dim strText3 as String

strText1 = txtText1
strText2 = txtText2
strText3 = txtTest3

DoCmd.GoToRecord , , acNewRecord

I assume you would put it in a conditional statement, something like this:

Code:
If chkCheckBox1 = 1 Then
   Run code as above
End If
txtText1 = strText1
txtText2 = strText2
txtText3 = strText3



Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top