INSERT INTO

D

dhstein

In this code below:

DoCmd.RunSQL "DELETE * FROM tblCostChanges;"

DoCmd.RunSQL "INSERT INTO tblCostChanges SELECT * FROM qryCostChanges;"


Do the fields have to be identical in the query and the table? Same names ?
Same datatypes ? Same sizes? Thanks for any help on this.
 
D

Douglas J. Steele

dhstein said:
In this code below:

DoCmd.RunSQL "DELETE * FROM tblCostChanges;"

DoCmd.RunSQL "INSERT INTO tblCostChanges SELECT * FROM qryCostChanges;"


Do the fields have to be identical in the query and the table? Same names
?
Same datatypes ? Same sizes? Thanks for any help on this.

The number of fields must be the same. The names don't matter, but by
position they must have the same data type. Size only matters if you might
be attempting to put too large a value (in other words, if field 4 in
qryCostChanges is too big to fit in field 4 of tblCostChanges)
 
Top