SQL update query to set a record field to null

isaacski

Registered User.
Local time
Today, 08:55
Joined
Nov 30, 2012
Messages
67
Hi Guys,
I think I'm close but I'm struggling with the syntax on this guy... On a push of a button from a form, I want to locate specific records within the table and update a field to Null if it matches a name

Dim strSQL As String
strSQL = "UPDATE tblmaster SET Score = "" WHERE [AdvocateName] = 'Anna Maria'"
DoCmd.RunSQL (strSQL)

I'm certain I don't have the syntax correct between the Set to Null and WHERE clauses... any advice?

Much appreciated!

Kim
 
Well, your quotes are screwing up the string, but if you want it Null then you don't want them anyway. Try

strSQL = "UPDATE tblmaster SET Score = Null WHERE [AdvocateName] = 'Anna Maria'"
 
As usual I over complicate things and Paul sets me straight!!! Thanks Paul!
 
We humans may not be able to see it but there is a difference between null and "". The latter is a Zero Length String (ZLS). The two are frequently confused. So now you know:)
 

Users who are viewing this thread

Back
Top Bottom