
November 25th, 2003, 09:15 AM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
MS Access record manipulation with vba
Hi,
I've got an access database containing several tables containing the same fields but for different companies. I've created a form to allow users to enter information which is added as a new record to the appropriate table (e.g. if cboCompany.Value = "Company A" then store data from other fields into table "tblCompanyA"). I create the new records using DoCmd.RunSQL "INSERT INTO and it works fine.
My problem is that I want to be able to read the value from the primary key (autonumber) field for the new record, so that I can store it to a variable and show it to the user (it's a unique number for correspondence tracking). I've tried looking around for techniques but am not having much luck. I think the sql query ident_current is what I need to use, but can't work out how.
FYI, I'm writing the VBA code from Access 2002 on WinXP.
Any help will be glady received.
|