Solved

VBA Run-Time error '3265' parameter query

Posted on 2015-02-24
4
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

623 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