Question : Automatically inserting records in a temp table

Let's say I have a temp  table called tblCars which has three fields, "year", "make", "model".

When I click a command button, I would like to automatically insert the following records into that table.

2005, DODGE, DURANGO
1998, DODGE, GRAND CARAVAN
1994, PONTIAC, GRAND PRIX
1990, PONITAC, SUNBIRD

How would I do that  using strictly code?

Thanks


Answer : Automatically inserting records in a temp table

If your other data is not table-based, however, you'd have to issue 4 separate INSERT statements:

Currentdb.Execute "INSERT INTO YourTempTable(year, make, model) VALUES('2005','Dodge','Durango')"
Currentdb.Execute "INSERT INTO YourTempTable(year, make, model) VALUES('1998','Dodge','Grand Caravan')"
etc etc

Access cannot accept an array of values and iterate through and insert to fields, as other db engines can.
Random Solutions  
 
programming4us programming4us