Where ...and .....and (1 Viewer)

Onlylonely

Registered User.
Local time
Today, 23:13
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)
 

June7

AWF VIP
Local time
Today, 07:13
Joined
Mar 9, 2014
Messages
5,470
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.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:13
Joined
Aug 30, 2003
Messages
36,125
And if the field is text the value needs quotes around it:

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

Users who are viewing this thread

Top Bottom