Jump to content

INSER INTO problem with Access and VB... help anyone?


fragglea

Recommended Posts

Im trying to take a set of variables "AssetNumber" "EquipmentCode" and insert a new record into the [Asset Numbers] table. In a loop to insert a list in a single go.Iv been banging my head on this for a few hours and reduced the SQL statement to the most simple procedure I can.Its looking like this:SQL = "INSERT INTO AssetNumbers([Asset Number]) VALUES ('44'),('43');"the I use the doCmd.runSQL to run the script.I know something is wrong with the script. I just cant see what.The above statement returns the "missing ; ". So what am I missing?This is being used in Access, with VB.

Link to comment
Share on other sites

Alright.Now. Since access apparently cant add tables in a bulk fasion.I can force it to insert one at a time in a loop and remove the "Im about to insert.....".For Loop1 = 1 to 30mySql = "INSERT INTO myTable( ...) " & _"VALUES (" & Loop1 ", ...) " & _CurrentDb.Execute mySql, dbFailOnError Next Loop1This will add one record at a time and surpress the irritating "press 'yes' "message.It takes a little while though...Any thoughts on a speedier way to accomlish this? (give the data is in a "listbox" not another table)

Link to comment
Share on other sites

Well, the main problem is that Access just isn't very fast. Or good. It's easy to use, but that's about it, you're fairly limited in what you can do and how fast you can do it compared with other database systems like SQL Server or MySQL.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...