Is it possible to execute a prepared statement in MS Access on a local table in VBA like this:
UPDATE part SET part_description=? WHERE part_id=?
If so how is it done?
Is it possible to execute a prepared statement in MS Access on a local table in VBA like this:
UPDATE part SET part_description=? WHERE part_id=?
If so how is it done?
That example used a new, unsaved
QueryDef
. If you have a saved parameter query, you can use it instead by substituting this line for theCreateQueryDef
line:Either way, you can then refer to individual parameters by their names as I did, or by their positions in the SQL statement ... so this will work same as above:
Additional notes:
.Value
is the default property for aParameter
, so including it here is not strictly required. On the other hand, it doesn't hurt to be explicit.!which_id
, which is more concise than.Parameters("which_id")