This is a variable declaration
Dim strSQL As String
Append queries add records to a table. They do not create tables.
Make-Table queries create tables from scratch (table gets re-created if it already exists). They look like:
Code:
SELECT fld1, fld2, fld3 INTO tblName
FROM tblSource
My code quote was for an UPDATE query which changes field values. It doesn't clear the table contents, it just clears a single field in all records.
Your program is saying you have a syntax problem in the SQL statement. I fixed two things - first is variable declarations and second was to specify precisely how to select the fieldnames.
How about this, I'll go down to basics.
Make sure your references are set: Open up any code module, then go up to the Tools Menu and select references. For this make sure that "Microsoft Access 9.0 Object Library" is checked (that's Access2K - Access97 would be 8.0) (it probably is by default)
Next, build your own delete query.
Go to the queries, use the wizard interface and select this pre-existing table with all fields including the one you wish to clear.
Only select the single field that you wish to clear the contents on.
In Design Mode go to the toolbar at the top of the screen and change it to an UPDATE query. In the 3rd Row labeled 'Update To' ONLY for the field you wish to clear, put the keyword 'Null'.
Now, save it.
Reopen it in design mode and then right click on the blue bar at the top of the query window. Select SQL View
Make sure that the SQL used in the AutoExec procedure looks precisely like the above. When you're assigning the command to the variable (strSQL) make sure you surround it with double quotes.
Try running it again.
Mike