I have the following code.
Set rstDB = CurrentDb
Set rstEvalForm = CurrentDb.OpenR ecordset("tblRM AEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwar eCheck] = Me.chkHardware
![blnWiringConnec tionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualCommen ts] = Me.txtVisualCom ments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComment s] = Me.txtPowerComm ents
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComment s] = Me.txtLaserComm ents
![intFirstTargetA ctual] = Me.txtFirstBIT
![intLastTargetAc tual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Clo se
Set rstEvalForm = Nothing
Set rstDB = Nothing
No problem. It all works good.
However, I want one more piece of information. How do I grab the
autonumber value created in the table after the recordset update has
run? I want to display this number in a hidden text box on the form I
am creating the recordset from. I want to do this while the form has
focus and is visible.
Thanks in advace.
Troy Lee
Set rstDB = CurrentDb
Set rstEvalForm = CurrentDb.OpenR ecordset("tblRM AEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwar eCheck] = Me.chkHardware
![blnWiringConnec tionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualCommen ts] = Me.txtVisualCom ments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComment s] = Me.txtPowerComm ents
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComment s] = Me.txtLaserComm ents
![intFirstTargetA ctual] = Me.txtFirstBIT
![intLastTargetAc tual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Clo se
Set rstEvalForm = Nothing
Set rstDB = Nothing
No problem. It all works good.
However, I want one more piece of information. How do I grab the
autonumber value created in the table after the recordset update has
run? I want to display this number in a hidden text box on the form I
am creating the recordset from. I want to do this while the form has
focus and is visible.
Thanks in advace.
Troy Lee
Comment