Macro help using QueryDef

  • Thread starter Thread starter panoffp
  • Start date Start date
P

panoffp

I am using the following VB code to create a temp query.

' get cycleID from cycle Table
Set qdfC = dbs.CreateQueryDef("", _
"Select ID From Cycle where Cycle_Yr_Month = " & YrMon & _
" AND Cycle = " & Cyc & " ;")
Set rsC = qdfC.OpenRecordset(dbOpenSnapshot, dbReadOnly,
dbReadOnly)

When I execute the OpenRecord set command I get a Runtime Error: 3061. Too
few parameters, Expected 1.

I must be missing something in the explanations. Thank you in advance for
you time and suggestions!
 
What are the data types of Cycle_Yr_Month and Cycle? If either are text,
then the value you're passing must be enclosed in quotes.

BTW, macros don't use VBA in Access. You'd be better off posting questions
like this in microsoft.public.access.modulesdaovba.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)




I am using the following VB code to create a temp query.

' get cycleID from cycle Table
Set qdfC = dbs.CreateQueryDef("", _
"Select ID From Cycle where Cycle_Yr_Month = " & YrMon & _
" AND Cycle = " & Cyc & " ;")
Set rsC = qdfC.OpenRecordset(dbOpenSnapshot, dbReadOnly, dbReadOnly)

When I execute the OpenRecord set command I get a Runtime Error: 3061. Too
few parameters, Expected 1.

I must be missing something in the explanations. Thank you in advance for
you time and suggestions!
 
Back
Top