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!

OpenRecordset Parameter Query

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
0
0
BE
Hello,

I have a query who needs a value of a Form. Its works perfectly when I open the query. He retrieve the parameter from the Form by this reference.

Code:
MONTH: [Forms]![F_01]![txtFile]

However, when the Function create a recordset based on the query to get the total record, vba said that the query has to few parameters. Do I need to open my Form in the code ?

Code:
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("001_QS", dbOpenDynaset)
rst.MoveFirst
rst.MoveLast
Count3 = rst.RecordCount
rst.Close

 
You may try this instead:
Count3 = DCount("*", "001_QS")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top