Error #3265 Item not found in this collection

G

Guest

Good Afternoon All,

What am I doing wrong with the following:

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("Append_tbl_Svc")

qdf.Parameters("tbl_Svc.RecordID") = Me.RecordID
qdf.Execute

The error reads Run-Time Error 3265 Item not found in this collection
and it highlights the "qdf.Parameters("tbl_Svc.RecordID") = Me.RecordID" line.

Thanks!
Renee
 
G

Guest

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("Append_tbl_Svc")

qdf.Parameters(0) = Me.RecordID
qdf.Execute
 
G

Guest

Thank you Klatuu :)

I have a question about the paramaters(0). How does the query know how
to appy the parameter of Me.RecordID? I went back and added a
forms![formname]![recordID] type statement to the criteria, and that works;
but, I am curious if there is a different way to use the parameter to
identify what field to apply the Me.RecordID too.

Thanks again for your time Klatuu,
Renee
 
G

Guest

In the query builder, the parameters are left column to right column. So, If
you had two parameters, you would use Parameters(0) for the left most one and
Parameters(1) for the next one.

Renee said:
Thank you Klatuu :)

I have a question about the paramaters(0). How does the query know how
to appy the parameter of Me.RecordID? I went back and added a
forms![formname]![recordID] type statement to the criteria, and that works;
but, I am curious if there is a different way to use the parameter to
identify what field to apply the Me.RecordID too.

Thanks again for your time Klatuu,
Renee

Klatuu said:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("Append_tbl_Svc")

qdf.Parameters(0) = Me.RecordID
qdf.Execute
 
G

Guest

I understand, thanks again :)

Klatuu said:
In the query builder, the parameters are left column to right column. So, If
you had two parameters, you would use Parameters(0) for the left most one and
Parameters(1) for the next one.

Renee said:
Thank you Klatuu :)

I have a question about the paramaters(0). How does the query know how
to appy the parameter of Me.RecordID? I went back and added a
forms![formname]![recordID] type statement to the criteria, and that works;
but, I am curious if there is a different way to use the parameter to
identify what field to apply the Me.RecordID too.

Thanks again for your time Klatuu,
Renee

Klatuu said:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("Append_tbl_Svc")

qdf.Parameters(0) = Me.RecordID
qdf.Execute


:

Good Afternoon All,

What am I doing wrong with the following:

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.QueryDefs("Append_tbl_Svc")

qdf.Parameters("tbl_Svc.RecordID") = Me.RecordID
qdf.Execute

The error reads Run-Time Error 3265 Item not found in this collection
and it highlights the "qdf.Parameters("tbl_Svc.RecordID") = Me.RecordID" line.

Thanks!
Renee
 

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