Syntax error in update query

  • Thread starter Thread starter Jean-Paul
  • Start date Start date
J

Jean-Paul

When running following code I get a syntax error...
I can not find what is wrong:

DoCmd.RunSQL "UPDATE [Adressen metaal] SET [Adressen
metaal].Datum_bezoek = "", [Adressen metaal].bezoeken = False WHERE
[Adressen metaal].Nummer = " & Forms!bedrijven!bedrijfsnummer & ";"

Forms!bedrijven!bedrijfsnummer is a numeric field

Thnaks for your kind help
JP
 
What data type is bezoeken? If a text field you would need quotations around
it. If a Boolean yes/no field, try 0 instead of False.

Also you could try substituting a number instead of the reference to the
form field for testing.
 
I found it has to do with:

[Adressen metaal].Datum_bezoek = ""

in the syntax

UPDATE [Adressen metaal] SET [Adressen metaal].Datum_bezoek = "",
[Adressen metaal].bezoeken = 0 WHERE [Adressen metaal].Nummer = " &
Forms!bedrijven!bedrijfsnummer & ";"

[Adressen metaal].Datum_bezoek is a date field and the update query
should clear what has been entered in the field....

Any idea?
Thanks
 
Try use Null rather than your attempt at placing a zero-length-string into a
date field.
DoCmd.RunSQL "UPDATE [Adressen metaal] SET Datum_bezoek = Null, bezoeken =
False WHERE
Nummer = " & Forms!bedrijven!bedrijfsnummer

--
Duane Hookom
Microsoft Access MVP


Jean-Paul said:
I found it has to do with:

[Adressen metaal].Datum_bezoek = ""

in the syntax

UPDATE [Adressen metaal] SET [Adressen metaal].Datum_bezoek = "",
[Adressen metaal].bezoeken = 0 WHERE [Adressen metaal].Nummer = " &
Forms!bedrijven!bedrijfsnummer & ";"

[Adressen metaal].Datum_bezoek is a date field and the update query
should clear what has been entered in the field....

Any idea?
Thanks


Jerry said:
What data type is bezoeken? If a text field you would need quotations around
it. If a Boolean yes/no field, try 0 instead of False.

Also you could try substituting a number instead of the reference to the
form field for testing.
 
Back
Top