Aberrant_Geek
New member
- Local time
- Today, 15:26
- Joined
- Jun 11, 2013
- Messages
- 8
Hi all, and thanks for taking a look.
Here's my Goal: To open a saved query that has a parameter, setting that parameter via a VBA sub.
Here's my Problem: I was getting various errors, but after debugging my program a bit, it comes down to a "Data Type Conversion Error"
Here's my Code:
I've been all over the forums and tried several different approaches, all to no avail. Any help is appreciated! If you need any other code, let me know. The Query runs fine in the QDT, but kicks back an error when I try to run it from my sub.
Here's my Goal: To open a saved query that has a parameter, setting that parameter via a VBA sub.
Here's my Problem: I was getting various errors, but after debugging my program a bit, it comes down to a "Data Type Conversion Error"
Here's my Code:
Code:
Set db = CurrentDb
Set qd = db.QueryDefs("qryMY_DATA")
qd.Parameters(0) = Me.txt_ReferenceID
Set rs = qd.OpenRecordset("qryMY_DATA", dbDynaset)
Code:
'*** Database Variables
Dim db As DAO.Database, rs As DAO.Recordset, gq As DAO.QueryDef, prm As DAO.Recordset
I've been all over the forums and tried several different approaches, all to no avail. Any help is appreciated! If you need any other code, let me know. The Query runs fine in the QDT, but kicks back an error when I try to run it from my sub.