Reputation: 233
I'm stuck on this SQL, it is saying that I am missing an operator and highlighting "Available"
. What I am trying to do is create this Update query in VBA, I need the field [TS]
to update but only if the [Status]
is "Available". Here's the full code below:
UPDATE attendance SET TS = " & iif [Status] = "Available" Then DMax("[TS]", "attendance") + 1 & " WHERE [userID]= " & rs!userID
I'm thinking I may not have this statement in the correct order.
Upvotes: 0
Views: 27
Reputation: 34
"IIF" is a function that expects three parameters (wrapped in parenthesis), and returns either the true-result or the false-result depending on the value of the condition, like this: iif(condition, true-result, false-result).
But, even if you fixed that syntax error in your query, I don't think your query would do what you are hoping for. Maybe something like this would work better:
"UPDATE attendance SET [TS]= [TS]+1 WHERE [userID]=" & rs!userID & " AND [Status]=""Available"""
Upvotes: 1