How to know autonumber field from a table in Visual Basic
Hi... I'm a newbie at Visual Basic. I'm building a database application using Access. The main problem I'm having now is that I save an image with certain name, according with the id of the product. E.g.:
Product ID: 177
company ID: 2
The image should be saved as 2-177.bmp
I'm using adodc1.recordset.Addnew to add the new register in the database, but I can't find an easy way to get the productid number (autonumber field). I would appreciate if someone can help me.
Thanks!
Visual Basic Classic
Last Comment
galo_6
8/22/2022 - Mon
Éric Moreau
You will need to add a new entry to your table, retrieve the ID number and then save your picture.
Emoreau: I've just read the URL you mentioned and I don't see a clear answer to my problem.
I'm using adodc to retrieve the records from the database. I have a textbox (lets say Text1) connected to the field productid Text1.Datafield = productid . I'm using
adodc1.Recordset.MovePrevious
to save the changes to the database and then I go back to grab the productid ....
adodc1.Recordset.MoveNext
My problem is that the productid isn't available. All the other text boxes are populated with the info from the database except the one with the productid info.
In your link I understood, that the only way I can get the autonumber is using Access 2000 and Jet 4.0.
I migrated to Access 2000 (i was using 97), but still I can't use Jet 4.0. I created a new database in access 2000 just for testing, but when I build the connection for the ADODC, there is an error: Error in the connection test when initializing provider. (this is just a translation because my system is Spanish).
see http://support.microsoft.com/default.aspx?scid=kb;en-us;244779