Hi guys,
You can call a parameter query as a record set, but you have to pass the parameters explicitly, even if they are looking at an open form.
All this code is in DAO. make sure you have set a reference:
Method 1 (the proper way!):
Dim db As DAO.Database
Dim qd as DAO.QueryDef
Dim rs as DAO.Recordset
Set db=currentdb
set qd=db.querydefs("QueryName"

qd("[Forms]![FrmViewUPCCodes]![Combo24]"

=[Forms]![FrmViewUPCCodes]![Combo24]
qd("[Forms]![FrmViewUPCCodes]![Combo26]"

=[Forms]![FrmViewUPCCodes]![Combo26]
set rs=qd.openrecordset
Method 2 (The quicker way):
Dim db As DAO.Database
Dim qd as DAO.QueryDef
Dim rs as DAO.Recordset
Dim prm as DAO.Parameter
Set db=currentdb
set qd=db.querydefs("QueryName"
for each prm in qd.parameters
prm.value=eval(prm.value)
next prm
Method 3 (An alternative way):
Take a butchers at FAQ701-1964.
This is my preferred way, for no particular reason.
Some of the syntax may ba a bit out, but I hope you get the picture.
Let me know if you need help with this.
B ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web:
----------------------------------------