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
Solved

VBA Run-Time error '3265' parameter query

Posted on 2015-02-24
4
251 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 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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