Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too Few Parameters- I can't see the problem

Status
Not open for further replies.

malibu65k

Programmer
Sep 27, 2004
131
0
0
US
Dim db As DAO.Database
Dim recSec1 As DAO.Recordset

Set db = CurrentDb()
Set recSec1 = db.OpenRecordset("qryTACC_RPT_Sec1")

The query runs fine, it askes for a date on a form that is open with a selected date in a textbox. But when I try to use the above code I get a "too few parameters. Expected 1" error.

I can't figure out why. Can anyone help?

Thanks!

:)
 
Try this:
Code:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Dim recSec1 As DAO.Recordset

Set db = CurrentDb
Set qdf = db.QueryDefs("qryTACC_RPT_Sec1")
For Each prm In qdf.Parameters
  prm.Value = Eval(prm.Name)
Next prm
Set recSec1 = qdf.OpenRecordset

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
If you aren't retrieving anything from the recordset, can you just use DoCmd.RunQuery?

Beir bua agus beannacht!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top