Help please needed for the above.
I have a query (call it A) with Parameters defined in it( call them
ParmNameA1 and ParmNameA2), that uses two sub-queries (say B and C) each with
parameters as well.
I want to run query A using
DoCmd.OpenQuery A
and then supress the Parameter dialog boxes by filling in the parameters in
the code.
I have tried setting the Parameters programmatically using something like
this:
MYDB.QueryDefs("A").Parameters("TheParmNameA1").Value = "xxxx"
MYDB.QueryDefs("B").Parameters("TheParmNameB1").Value = "xxxx"
But I am still prompted for all the Parameters when the query executes.
By the way unfortunately the DB I am working with is Access 97.
Please help this is driving me batty.
Thanks
I like to run queries in a different way, I create an empty query called
GlobalQuery, and then I assign to it the string I want to run.
e.g
Function aaaaa(ParamNumber as long, ParamString as string )
Dim DBS As Database
Dim rst As Recordset, SqlStr As String
Set DBS = CodeDb
SqlStr = "SELECT * FROM MyTable Where Field1 =" & ParamNumber & " AND Field2
= '" & ParamString & "'"
DBS.QueryDefs("GlobalQuery").SQL = SqlStr
docmd.openquery "GlobalQuery"
End Function
Just a note, mybe you would like that.
> Help please needed for the above.
>
[quoted text clipped - 22 lines]
>
> Thanks