Import Excel into Access - Handling Autonumbers

F

forsythe303

I have an Excel spreadsheet on my computer that I want to use as a front-end
for an Access dB on another machine.

My Access key field is an autonumber, which I have no way of knowing the
value of at the time of entering information into the Excel spreadsheet.

What can I put in the Excel spreadsheet to get Access to accept the rest of
the record and autonumber for me?

Ex. Access Fields
(AutoNumber) Name Address

Ex. Excel Fields
???? Name Address
 
J

Jamie Collins

forsythe303 said:
What can I put in the Excel spreadsheet to get Access to accept the rest of
the record and autonumber for me?

AFAIK you cannot assign a value to an autonumber column, not even
NULL. Simply omit the autonumber column from your INSERT DML.
an autonumber, which I have no way of knowing the
value of at the time of entering information into the Excel spreadsheet.

That is incorrect. One approach is to use a recordset behind the
scenes: add the cell values to a new record in the recordset and write
the generated autonumber value from the recordset back to the
worksheet. You may need to use a disconnected recordset or a
transaction to ensure data isn't written uncontrollably to the
database.

Jamie.

--
 

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