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

QUERYDEF PARAMETER QUESTION

Status
Not open for further replies.

trystanhuwwilliams1

Programmer
Jan 7, 2003
44
GB
Hi,

I want to open a recordset based on a parameterized query with two parameters. This code works for opening a single parameterized query:
Code:
SET QDF = DB.QUERYDEFS("RECORDS QUERY")
QDF.PARAMETERS(0)=FORMS!STAFF!1STDATE
SET RST = QDF.OPENRECORDSET

How can I alter this code so that it includes another parameter?

Cheers
 
hi,

When you set up the query that you are referring to in Access, you should place a parameter in criteria that you will refer to in the code. Once you have done that, you can assign variables to these parameters in the code. Example:

Set qdf = dbs.QueryDefs("Records Query")
qdf![LastNameParam] = Forms!staff!LastName
qdf![DateOfBirthParam] = Forms!staff!DateOfBirth
Set rst = qdf.OpenRecordset

I hope this helps. I am using code similar to this in one of my projects.

Good Luck!
 
Hi again,

I think I may have misunderstood your problem. Check out

thread703-571214

Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top