Reputation: 11
What I am trying to accomplish is update multiple records in a table that meets criteria that is stored in a combobox. The field that I am trying to update set to Null (also a combobox stored as text, key field hiding).
I have been able to get the where statement working with a checkbox
[Main].[TAD] is a combobox stored as text, primary key field hiding. [TADSlctRtrn] is a unbound combobox stored as text, primary key field hiding on a unbound form. both fields are linked to the same data.
Code that I have tried (code works without WHERE statement)
CurrentDb.Execute "UPDATE [Main] SET [TAD] = Null WHERE [TAD] = " & Me.TADSlctRtrn
CurrentDb.Execute "UPDATE [Main] SET [TAD]= Null" & "WHERE [TAD] = Me.TADSlctRtrn.Value"
CurrentDb.Execute "UPDATE [Main] SET [TAD]= Null" & "WHERE [TAD] = Me.TADSlctRtrn.text"
CurrentDb.Execute "UPDATE Main SET TAD = Null" & "WHERE TAD = Me.TADSlctRtrn.Value"
Run-time error 3075:
syntax error (missing operator) in query expression '[TAD] = jackson'
Run-time error 3075:
syntax error (missing operator) in query expression 'NullWhere TAD = ME.TADSlctRtrn.Value'
Upvotes: 0
Views: 57
Reputation: 11
Solved
Code that worked
CurrentDb.Execute "UPDATE [Main] SET [TAD] = Null WHERE [TAD] = '" & Me.TADSlctRtrn & "'"
Upvotes: 1