Need to set data values in tables

D

Desert Bear

I am successfully updating tblVersion with a new record
1) I need to transfer the primary key from tblVersion to the foreign key for tblTasks
2) I also need to set the field "Active" in the new tblVersion record
3) And, I need to retrieve the last record in another table.
Can I use Select Max([tblPerson.perID],[tblPerson.perFullName]) From tblPerson; in a combo box and have just that last record

For #1 and #2, the error is "can't assign value to this object
The code currently is
Private Sub cmdCopyPlanVersion_Click(
'Make a complete copy of the Plan Version in tblVersion and tblPlanTask
On Error GoTo Err_cmdCopyPlanVersion_Clic
Dim stDocName As Strin
Dim intpverID As Intege

'Run an update query to set all of current person's versions to no. Works
stDocName = "qupdActiveVersionNo
DoCmd.OpenQuery stDocName, acNormal, acEdi
DoCmd.Close acQuery, stDocName, acSaveYe

'Run an append query to make a copy of Plan VERSIO
stDocName = "qryCopyPlanVersionRecord" 'Do NOT change this query's name
DoCmd.OpenQuery stDocName, acNormal, acEdi
Me.pverPlanVersionActive =
intpverID = Me.pverPlanVersionID.Valu
DoCmd.Close acQuery, stDocName, acSaveYe
DoCmd.RunCommand acCmdSaveRecord 'force save of new version recor

'Run an append query to make a copy of all Plan Tasks for the new Plan Version recor
stDocName = "qryCopyPlanTaskRecords" 'Do NOT change this query's name
DoCmd.OpenQuery stDocName, acNormal, acEdi
pverPlanVersionID.Value = intpverID ' error, field not update
DoCmd.Close acQuery, stDocName, acSaveYe
Exit_cmdCopyPlanVersion_Click
Exit Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top