Select All Checkbox - Error Code 3464

tucker61

Registered User.
Local time
Today, 08:30
Joined
Jan 13, 2008
Messages
341
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.
 
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
 
Also is Temp_Deliveries_Last_30.In_Group really a boolean
 

Users who are viewing this thread

Back
Top Bottom