Where ...and .....and

Onlylonely

Registered User.
Local time
Today, 21:15
Joined
Jan 18, 2017
Messages
43
Hi All,

Appreciate if you could help me out of this.

I've no issue on below code.

Code:
If Forms!Checklist!Frame102!.Value = 1 Then

sSQL = "Update Issuetbl Set [Issuetbl].[Result] = 'Pass'  WHERE [Issuetbl].[Serial_Number] = '" & Forms!Checklist!txtSN & "' AND [Issuetbl].[Character_ID] =2"
CurrentDb.Execute (sSQL)

But for this 1, it has an data mismatch error.
Code:
If Forms!Checklist!Frame102!.Value = 1 Then

sSQL = "Update Issuetbl Set [Issuetbl].[Result] = 'Pass'  WHERE [Issuetbl].[Serial_Number] = '" & Forms!Checklist!txtSN & "' AND [Issuetbl].[Character_ID] =2 [COLOR="RED"]AND [Issuetbl].[Character_ID] =1[/COLOR]"
CurrentDb.Execute (sSQL)
 
Even if it didn't error, no record will meet the criteria of:

Character_ID=2 AND Character_ID=1

No record can have both values.
 
And if the field is text the value needs quotes around it:

"...[Character_ID] ='2'..."
 

Users who are viewing this thread

Back
Top Bottom