Only opening specific records

swee

Registered User.
Local time
Today, 02:50
Joined
Aug 11, 2004
Messages
66
I have the following code in the click event of my button,
Code:
Dim strCriteria As String
strCriteria = "[1stApproval]='-1'"
DoCmd.OpenForm "FrmLookupRecords", acNormal, , strCriteria

However when I click the button, there was an error that says,
The OpenForm action was cancelled. You used a method of the DoCmd object to carry out an action in Visual Basic, but then clicked Cancel in a dialog box. For example, you used the Close method to close a changed form, then clicked Cancel in the dialog box that asks if you want to save the changes you made to the form
What does this error mean? I want to open a form that only shows approved records and the column "1stApproval" is a Yes/No field. Thanks for any help!
 
You don't want the "-1" in single quotes. Try:

strCriteria = "[1stApproval]=-1"

or

strCriteria = "[1stApproval]=True"
 
Thanks Paul. Didn't think of that one. ;)
 

Users who are viewing this thread

Back
Top Bottom