Solved

VBA Run-Time error '3265' parameter query

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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 …

832 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