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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve record

Status
Not open for further replies.

mychalB

Programmer
Joined
Feb 8, 2002
Messages
7
Location
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top