Thread: Update Query
View Single Post
  #3  
Old May 28th, 2010, 04:32 AM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Update Query

On Thu, 27 May 2010 20:12:01 -0700, SageOne
wrote:

DoCmd.RunSQL "UPDATE [On Hold Records Table 2] SET [On Hold Records
Table 2].Occupied = null" & _
"WHERE ((([On Hold Records Table 2].Identifier)='" & Identifier & "'));"


Blanks are important! This will try to set Occupied to

nullWHERE ((([On Hold...

I'd suggest building up a SQL string from components - that makes it easier to
debug:

Dim strSQL As String
strSQL = "UPDATE [On Hold Records Table 2].Occupied = NULL " _
& "WHERE ((([On Hold Records Table 2].Identifier)='" _
& Identifier & "'));"
CurrentDb.Execute strSQL, dbFailOnError

Note the blank between the word NULL and the quote... it's relevant!

The Execute method lets you trap errors and doesn't prompt for confirmation.

--

John W. Vinson [MVP]