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

how 2 pass parameters to a qry behind subform while using sourceobject

Status
Not open for further replies.

Ashank4vba

Programmer
Apr 29, 2005
115
IN
Hi,

I don't think there are any posts (atleast recent ones) about my problem.

I have a query that accepts parameters. A subform has this query in its rowsource. In the main form (which has the subform), I set the subform control's sourceobject to the subform upon pressing a button.
Now, how do I also pass the parameters to the query on which the subform is based. I cant use 'OpenArgs' with this, can I?

Also, the point of all this is that, I set the rowsource of the subform from the mainform to a SQL version of the query without using parameters but it takes about 15 minutes to run!!!! I absolutely need to get it down to less than a minute (which is why I am trying to use a 'saved' version of the query).

In its simplest form, the sql version of the query does not contain any functions like 'IsNull()' etc., where the parameter version of the query does.
The confusing part is that I have a similar (saved) query in my database that runs in less than 10 seconds!
Its quite perplexing

Plz help.
Thanks a lot in advance.

-cheers
Ashank
 
can't you just use somthing like this
Where yourParameter = " & value1 & " And yourParameter = " & value2 & ";"
If it on the main form use this
Where yourParameter = " & forms![formname].value1 And yourParameter = " & forms![formname].value1 & ";"

DougP, MCP, A+
 
Thanks for your reply Doug.
I had written the 'sql version' of my query using the way you have mentioned.
I wanted to try it with a 'saved' version of the query using parameters in the hope that it would be faster.
 
It was a UNION query and I tried using 'UNION ALL' instead. It now runs in about 5 mins now.
If you have any other suggestions, please let me know.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top