SQL syntax for Update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks in advance for your help...

I am running an update query out of VBA by putting the SQL in a string and
using the DoCmd.RunSQL feature. In particular, I am trying to remove a value
from a date field in a table, without deleting the record as a whole.

I am having trouble finding syntax that will place an empty or null value in
the field, however. I have tried using an empty string "" and a variable with
a null or empty value in it - things that would work for a string - but get
back a data type error.

Here's an example of the kind of things I've written:
UPDATE tblAnyTable SET tblAnyTable.DateValue = ''"
UPDATE tblAnyTable SET tblAnyTable.DateValue = #''"#
UPDATE tblAnyTable SET tblAnyTable.DateValue = '' & datNullVariable & ""

Any suggestions will be very welcome.

Thanks again.

Jake
 
Assign the value Null:

UPDATE tblAnyTable SET [YourFieldNameHere] = Null;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top