PDA

View Full Version : [SOLVED] Pulling back Unique ID to excel



CuriousGeorg
08-19-2014, 02:41 AM
Hi,

I have a userform (in excel) that sends all the data input into access.

What Im wanting to know is if it is possible that when the user clicks "Add", I currently have a message box that confirms successfully added, Is it possible for that message box to include the Unique ID from Access in there?

for example:
"Entry number #1 - added"

(ideally without another userform doing such a thing)

westconn1
08-19-2014, 03:00 AM
Is it possible for that message box to include the Unique ID from Access in there?yes, of course it can be done, just query the table for the latest entry and return the id, to insert into msgbox

CuriousGeorg
08-19-2014, 03:19 AM
Sorry to be awkward, how would this look? not a BIG access user just using it at the moment to store the data.

"Select ID
From Table"

or something?
not sure how I'd get last entry

westconn1
08-19-2014, 05:13 AM
maybe try
"select max(ID) from table"

xld
08-19-2014, 08:54 AM
How does it insert the data? If you are controlling that from Excel, firing an update query that supplies all of the data, then do you already know the ID. If the ID is an identity column, then you need to query the database for the max value, and hope someone else hasn't added one in the meantime (but if it were an identity column, why would you want to tell them the ID?).