"Item not found" in QueryDef

M

Mr.E

I've been trying to pass multiple parameters to a query
for awhile (I posted on 9/23). I thought I had a solution
in using a query def. I keep getting an error "Item not
found in this collection". Very frustrating. Here is my
code:

Private Sub cmbTask1_Change()
Dim db As Database
Dim rst As Recordset
Dim qdf As QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("query1")
qdf.Parameters(2) = [Forms]![frmTime]![txtSun] & [Forms]!
[frmTime]![txtTest]
Set rst = qdf.OpenRecordset

the code keeps breaking on qdf.parameters line. Any ideas?
Thanks for your help.

Mr.E
 
M

Michel Walsh

Hi,


When it stops at that line, does

? Forms!frmTime!txtSun.Value & Forms!frmTime!txtTest.Value


evaluates to something or to the same error? What about


? qdf.Parameters(2).Name



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top