query variable in Querydefs

Adrianna

Registered User.
Local time
Today, 05:47
Joined
Oct 16, 2000
Messages
254
Should be a quick and easy one...I'm trying to run through several queries to output all of them into excel on different pages. I'm able to do this with tables no problem. I can run queries with the code individually now that I figured in the Parameter pre-declaration. The issue now is figuring out how to pass the string variable, "strQueryName", with the chaning query names to the querydefs statment.

PHP:
Set qdfMyQuery = dbITRepositoryLink.QueryDefs![strQueryName]
                qdfMyQuery.Parameters![Forms]![DataRollUp]![UIC2FindActIds] = [Forms]![DataRollUp]![UIC2FindActIds]
                Set rs = qdfMyQuery.OpenRecordset
 
QueryDefs(strQueryName)

doesn't work?
 
THanks! :rolleyes: Feeling silly...I think I'd tried the (strShtNm) before, but I guess I was trying so many things that I'd misinterpretted the error.

I'm getting an Item Not in Collection error from:
qdfMyQuery.Parameters![Forms]![DataRollUp]![UIC2FindActivityIDs]=[Forms]![DataRollUp]![UIC2FindActivityIDs]

I double checked the spelling my Access Query and all looks good. The parameter resides in my
WHERE (((dbo_tActivity.UIC)=[Forms]![DataRollUp]![UIC2FindActivityIDs]))
statement. So what the heck am I going wrong now:(
 
Just a small syntax change:
qdfMyQuery("[Forms]![DataRollUp]![UIC2FindActivityIDs]")=[Forms]![DataRollUp]![UIC2FindActivityIDs]
 
Thanks....logic seems to be right. They've taken the SQL Server down for quick maintenance (5 hours ago), so I'll test it when it's up again. THANKS!!! I'm sure it will work:-)
 

Users who are viewing this thread

Back
Top Bottom