Select All Checkbox - Error Code 3464 (1 Viewer)

tucker61

Registered User.
Local time
Today, 14:19
Joined
Jan 13, 2008
Messages
321
Guys i am struggling with my Check box to select all records in subform.

The code i have is below,
The Field names Delivery is a short text field, but i get error message 3464 - data type Mismatch in Criteria Expression.

if I run it as query it works, just not when i run as VB
my debug.print code produces

UPDATE Temp_Deliveries_Last_30 SET Temp_Deliveries_Last_30.In_Group = True WHERE (((Temp_Deliveries_Last_30.Delivery_reference)=01092712))

Code:
Dim strsql0 As String
Dim strsql1 As String
Dim strsql2 As String
Dim strsql3 As String
Dim strsql4 As String

strsql1 = "UPDATE Temp_Deliveries_Last_30 SET Temp_Deliveries_Last_30.In_Group = True "
strsql2 = "WHERE (((Temp_Deliveries_Last_30.Delivery_reference)="
strsql3 = [Forms]![FrmNonConformanceNew]![CboxDelRef]
strsql4 = "))"
strsql0 = strsql1 & strsql2 & strsql3 & strsql4
Debug.Print strsql0

CurrentDb.Execute strsql0

Please help.
 

Minty

AWF VIP
Local time
Today, 21:19
Joined
Jul 26, 2013
Messages
10,355
If the delivery reference is text you need some quotes around it.

Code:
strsql1 = "UPDATE Temp_Deliveries_Last_30  "
strsql1 = strsql1 & "SET Temp_Deliveries_Last_30.In_Group = True "
strsql1 = strsql1 & "WHERE (((Temp_Deliveries_Last_30.Delivery_reference)= '" &  [Forms]![FrmNonConformanceNew]![CboxDelRef] & "'))"

Debug.Print strsql1
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:19
Joined
May 21, 2018
Messages
8,463
Also is Temp_Deliveries_Last_30.In_Group really a boolean
 

Users who are viewing this thread

Top Bottom