UPDATE Not UpDating

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

TInUse is a YesNo Checkbox that I'm trying to set to true. It doesn't
seem to work. I'm getting a syntax Error.
The Table is called Tables and it's getting the TableNumber from TM
which is on the form running the code.

CurrentDb.Execute "UPDATE Tables, SET TInUse = True, WHERE TableNumber =
Me.TM"

Thanks
DS
 
Get rid of the commas.

As well, you need to put the reference to Me.Tm outside of the quotes:

CurrentDb.Execute "UPDATE Tables SET TInUse = True WHERE TableNumber = " &
Me.TM
 
Douglas said:
Get rid of the commas.

As well, you need to put the reference to Me.Tm outside of the quotes:

CurrentDb.Execute "UPDATE Tables SET TInUse = True WHERE TableNumber = " &
Me.TM

I get Error code 3601, to few parameters -1 expected......
What could it be?
Thanks
DS
 
Is TableNumber numeric, or are you storing a number in a text field?

If it's text, you need quotes around the value:

CurrentDb.Execute "UPDATE Tables SET TInUse = True WHERE TableNumber = " &
Chr$(34) & Me.TM & Chr$(34)

If that's not the problem, make sure you didn't misspell any of the field
names, and that Me.TM actually has the value you expect it does.

You can try

Dim strSQL As String

strSQL = "UPDATE Tables SET TInUse = True WHERE TableNumber = " &
Chr$(34) & Me.TM & Chr$(34)
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError

Look at what's printed for strSQL: does it make sense?
 
Back
Top