Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Not Null value to Query 1

Status
Not open for further replies.

0212

Technical User
Apr 2, 2003
115
0
0
US
Hi, all! I have a dialog box with which users type in userid and password. I check for valid info and then open a menu form. I have several forms where I have query based Comboboxes. The queries are parameter queries that take the userid input by the user to filter records. Only records that belong to the particular user will be seen by that user. Since some users may be authorized to look at all records, I would like to set the dialog box textbox to a value that will allow all records to be returned. The following code returns no records. Any ideas? Thanks for any help that you can give!!

If Me![User_ID] = "Jim" Then
Me![User_ID] = "Not Is Null"
Me![Pass_word] = "Not Is Null"
strUserID = "Jim"
strPassword = "Password"
End If
 
One way is to set the query's criteria to:
Like [Forms]![your login form]![User_ID]

And the code in the login form:
If Me![User_ID] = "Jim" Then
Me![User_ID] = "*"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV, thanks again! I thought about the 'Like' but didn't think about putting it in the query criteria! I really appreciate your help!

Jim.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top