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 a record but changing certain values

Status
Not open for further replies.

Dibblet

Technical User
Jul 14, 2005
20
GB
I hold information on a table about cartain jobs i.e. customerID, delivery date etc. Each job has a JobID. This table is called JOBS it is displayed on a form called JOBBOOK.
On this job form there is a subform containing all processes required for this job. This information is held in a separate table. This table is called TASKS.

I have a button on hte JOBBOOK form called "Create new job based on current job" the function of this button is to copy all the job details from the current job to a new record with a new JobID. At present the button will copy the details to a new record in the JOBS table.

I am having problems being able to create a new record in the TASKS table, I have been able to create new records but am unable to create these records with the new JobID.

Is there a way to copy records from earlier in a table and set a value of one of the fields in the record?
 
You can use append queries. For example:

[tt]strSQL="INSERT INTO TASKS ( Description, StartTime )
SELECT '" & Me.Description & "', TASKS.StartTime
FROM TASKS Where ID=" & Me.ID
CurrentDB.Execute strSQL[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top