Bring Access Primary Key # Back to Excel

RaunLGoode

Registered User.
Local time
Today, 10:55
Joined
Feb 18, 2004
Messages
122
I am entering a row of Data from an Excel Spreadsheet into an Access DB
After opening the DB I place the valve in each Excel cell into the proper Access field and then update the DB

ie:
...
DBS.AddNew 'Add a new record
DBS!Description = ActiveCell.Offset(0, 1).Value
DBS!Location = ActiveCell.Offset(0, 2).Value
DBS!Trade = ActiveCell.Offset(0, 3).Value
...
DBS.Update ' Update Access DB

Access Updates the record and assigns a primary key value to the new record

I need to copy the primary key value back to the Excel spread sheet and store the value in the first cell of each row. I was going to assign the primary key value to a variable and fill the excel cell from the variable.

I can't figure out how to Query the Access table for the new primary key value.

Could somebody help me?
 

Users who are viewing this thread

Back
Top Bottom