I am trying to put together a procedure to first add data into one table and then I need to return that primary key and have it part of the record set that will be added to another table.
How do I retreive that recordset?
Im looking at something like this....
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblSamples"
rs.AddNew
rs!LOCID = Me.lstLocatorID
rs!SAMPID = Me.txtSAMPID
rs!DateSampled = Me.txtDateSampled
rs!TIME = Me.txtTIME
rs!MatrixCode = Me.cboMatrix
rs!SampledBy = Me.txtSampBy
rs.Update
rs.Close
Set db = Nothing
Set rs = NothingSet
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblFieldTests"
rs.AddNew
rs!Sample_ID = ***Primary key of recently added record in tblSample****
Again how do I retreive that data?
Thx in advance,
Mychal
How do I retreive that recordset?
Im looking at something like this....
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblSamples"

rs.AddNew
rs!LOCID = Me.lstLocatorID
rs!SAMPID = Me.txtSAMPID
rs!DateSampled = Me.txtDateSampled
rs!TIME = Me.txtTIME
rs!MatrixCode = Me.cboMatrix
rs!SampledBy = Me.txtSampBy
rs.Update
rs.Close
Set db = Nothing
Set rs = NothingSet
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblFieldTests"

rs.AddNew
rs!Sample_ID = ***Primary key of recently added record in tblSample****
Again how do I retreive that data?
Thx in advance,
Mychal