Valery
Registered User.
- Local time
- Yesterday, 21:47
- Joined
- Jun 22, 2013
- Messages
- 363
Hi All,
I am running MS Access 2010. I would like to have a toggle button that selects and deselects a check box field. I have this SQL but it is returning a compile error.
Can you please assist? (please provide FULL coding - I did not write this one - I am at a beginner-intermediate level).
These are the queries:
qry_R_LabelSelectAll
qry_R_LabelDeselectAll
I am running MS Access 2010. I would like to have a toggle button that selects and deselects a check box field. I have this SQL but it is returning a compile error.
Can you please assist? (please provide FULL coding - I did not write this one - I am at a beginner-intermediate level).
Code:
Private Sub cmdLabelFlagSelectAll_Click()
If Me.cmdLabelFlagSelectAll.Caption = "Select All" Then
strSQL = "UPDATE [qry_R_LabelSelectAll] SET [LabelFlag] = True"
CurrentDb.Execute strSQL, dbFailOnError
Me.Requery
Else
strSQL = "UPDATE [qry_R_LabelDeselectAll] SET [LabelFlag] = False"
CurrentDb.Execute strSQL, dbFailOnError
Me.Requery
End If
End Sub
These are the queries:
qry_R_LabelSelectAll
Code:
UPDATE tblTenant SET tblTenant.LabelFlag = -1
WHERE (((tblTenant.MailList)=True) AND ((tblTenant.Deactivate)="N") AND ((tblTenant.Status)="M" Or (tblTenant.Status)="F"));
qry_R_LabelDeselectAll
Code:
UPDATE tblTenant SET tblTenant.LabelFlag = 0;