Recently Maarten a blog reader asks: TempVars (introduced with Access 2007) are great,
Windows 7 Product Key! But I have some problems in using them. I created a query with a TempVar as criteria. When I run the query it shows the correct data. But when I open the query in VBA using OpenRecordset, I get the message: “Run-time error 3061: Too few parameters. Expected 1.” This is the expected behavior. TempVars are defined in the scope of the Access Application object. When you use the CurrentDB.OpenRecordset method,
Microsoft Office 2010 Product Key, the resulting recordset is defined in the scope of the ACE database engine (DAO). Here is a workaround. Create and form based on the query and assign your recordset to it. Something like this… DoCmd.OpenForm "FormName",
Microsoft Office 2010 Key, WindowMode:=acHidden
Set rs = Forms("FormName").Recordset ... Do stuff DoCmd.Close acForm,
Windows 7 64 Bit, "FormName" Enjoy,
Office 2007 Professional! <div