[AccessD] Parameter make table query

Gustav Brock gustav at cactus.dk
Sat Aug 20 12:46:51 CDT 2005


Hi Chester

You could use this syntax for populating a recordset:

MyQDef1.Parameters("Pattern Name").Value = PatternName

However, this opens a new instance of the query knowing nothing of the
parameter setting above:
DoCmd.OpenQuery MyQDef1.Name, acViewNormal, acEdit

You will need to set the parameter to a public variable (or static
function), then create a function to retrieve that value; now, remove
the parameter and use this function in the query to supply the value
(after setting it in your code as previously).

/gustav


>>> Chester_Kaup at kindermorgan.com 17-08-05 23:27 >>>
I try to run the following code for a make table query but it still asks
for a parameter. Why?  Do I need to run it differently? Thanks.

PatternName = "123-4"

Set MyQDef1 = MyDb.QueryDefs("qry Actual Production after Inj Start
Date")

MyQDef1.Parameters![Pattern Name] = PatternName

DoCmd.OpenQuery "qry Actual Production after Inj Start Date",
acViewNormal, acEdit




More information about the AccessD mailing list