Link to home
Start Free TrialLog in
Avatar of lincstech
lincstech

asked on

Visual Basic and access autonumber

Hello,

Can anyone help me with an issue with auto number field in an access database. I get an error of data type mismatch in visual basic.net when I use the Intert Into.
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Don't explicitly insert the autonumber, as the records are inserted they are assigned numbers by access (hence the name AUTOnumber). If that doesn't help, I'll have to see your code.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can actually supply a value for the autonumber when running an Append query.  Otherwise, conversions would be even more of a nightmare than they already are.

Except for a conversion, you would never want to supply a value for the autonumber.  That is the point.  Access (actually Jet or ACE) provides the value automatically.

You are not running the query in Access though so this isn't really an Access question.  It is a question regarding the database engines Jet or ACE depending on whether you are using an .mdb or .accdb.  

I don't know if you can provide a value for the autonumber when you are using ADO.Net.  You probably just want to remove the autonumber column from your insert statement since I doubt you are doing a conversion.
Isn't that what I wrote?