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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read records from a query

Status
Not open for further replies.

bdjc

Technical User
Nov 6, 2001
4
Hello,

I have a date field in a query with a criteria of "=[Forms]![frmMyForm]![Date]". On form frmMyFrom I have the date field and a command button to open another form to display records based on the date entered. When I click the command button to open the other form I get this error message: Runtime error 3061 Too few parameters. Expected 1. I click on debug and this line is highlighted in the code: Set rst1 = CurrentDb.OpenRecordset("qryMyQuery").

I want to read records from the query whose date is equal to date entered on the form and then add records to another table. When I open the query myself the records are displayed correctly without any errors.

Can anyone help me, please?

Thank you,
bdjc
 
This is how I've done something similar. The macro I'm running opens the form with a where clause. Your where clause would be something like: Where frmMyForm.Date = YourTable.Date. I tried to do this without using a macro, but I couldn't get the syntax right.


If DCount("[YourTable]", "qryMyQuery") >= 1 Then
DoCmd.RunMacro frmMyForm
Else
MsgBox "There are no records with that date."
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top