Solved

VBA Run-Time error '3265' parameter query

Posted on 2015-02-24
4
216 Views
Last Modified: 2016-02-10
I get the error on this line:  qdf.Parameters("[episode]").Value = 10
Error: Item not found in this collection.


Sub test()
    
    Dim dbs As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim prm As DAO.Parameter
    Dim rst As DAO.Recordset
    
    Set qdf = CurrentDb.QueryDefs("ValueMemo Query2")
    
    qdf.Parameters("[episode]").Value = 10
    
    Set rst = qdf.OpenRecordset
    
    Do While Not rst.EOF
        Debug.Print rst("ValueMemo")
    Loop
    
End Sub

Open in new window

0
Comment
Question by:rrhandle8
  • 2
4 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40629799
Do you actually have a parameter named episode in your query or is that a fieldname?

Ron
0
 

Author Comment

by:rrhandle8
ID: 40629803
SELECT *
FROM FieldValue AS f, [session] AS s
WHERE f.objectid = s.sessionid and s.isnote=0 and  s.providerid = 2 and s.episodeid = ["episode"]
ORDER BY s.StartDateTime DESC;
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 40629807
I believe that should be:
SELECT *
 FROM FieldValue AS f, [session] AS s
 WHERE f.objectid = s.sessionid and s.isnote=0 and  s.providerid = 2 and s.episodeid = [episode]
 ORDER BY s.StartDateTime DESC; 

Open in new window

Remove the quotes around "episode"
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40629810
revise your query like this

PARAMETERS episode Long;
SELECT *
 FROM FieldValue AS f, [session] AS s
 WHERE f.objectid = s.sessionid and s.isnote=0 and  s.providerid = 2 and s.episodeid = [episode]
 ORDER BY s.StartDateTime DESC;
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now