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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a dynamic query def

Status
Not open for further replies.

DHSBW

Technical User
Jan 23, 2007
11
US
I'm getting a runtime error 3061: "Too few parameters" when I try to create a dynamic query def based on two parameters. Thanks for your help in advance.


S1 = "Select [User Name],[Password], [Administrator] from [User Accounts] WHERE (([User Name]= [Forms]![Login]!UID) And ([Password] = [Forms]![Login]!PW))

Set Def1 = Data1.CreateQueryDef("UserScreen", S1)
 
Try:

Code:
S1 = "Select [User Name],[Password], [Administrator] from [User Accounts] WHERE (([User Name]=" & """" & [Forms]![Login]!UID & """" & ") And ([Password] = " & """" & [Forms]![Login]!PW & """" & "))

UID and PW are text strings so need a text qualifier around them.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top