Parameter Query

pdbowling

Registered User.
Local time
Today, 20:29
Joined
Feb 14, 2003
Messages
179
Hi all, I've got a parameter query that works fine, I just don't know how to display the result table.


It's set up in DAO right now but it is not required to stay that way.
This is the query and it gets in to memory just fines.

Set qd = dbs.QueryDefs!queryArchive2
qd.Parameters![Dept] = myDept
qd.Parameters![Type] = myTruckType
qd.Parameters![#Start#] = myStartDate
qd.Parameters![#End#] = myEndDate
Set rst = qd.OpenRecordset

Is there something like rst.show or rst.display??

I wouldn't mind using DoCmd.OpenQuery if I can pass in the parameters.... any other suggestions for getting the parameters into the query and showing it in code would be fine.
Thanks all
PB
 
From A2k on and on upward versions of Access you can set an recordset directly the form's property with the same name. You can either use a DAO or an ADO recordset.

Another possibility would be, passing the parameter(s) to the form in the OpenForm method lst optional argument. Through parsing these parameters out of the OpenArgs property in the form's open event (it is one string), you could replace the parameters in a (new) query with these values. Then set the query or a string variable holding the query's text to the form's RecordSource.

One other method would be, setting the Where Clause argument in the OpenForm call, by just passing the whole Where Clause of your query, but keeping the word Where[/] out. In this case there is no need for a parameter query. Later the argument will become the content of the property Filter in the form.
 

Users who are viewing this thread

Back
Top Bottom