M
Maver1ck666
Hi,
I have a form where a user inputs a "start date" and "end date" (fields are
called date1 and date2). The form is called frm stats closures date.
When they exit the date2 field, it opens another form which has the
following event procedure on current;
Private Sub Form_Current()
Dim db As Database
Dim rst As Recordset
Dim Qdf As QueryDef
Set db = CurrentDb
Set Qdf = db.CreateQueryDef("")
With Qdf
.SQL = "SELECT Count([Tbl FUNDClosures Completed].CompleteDate) AS
CountOfCompleteDate FROM [Tbl FUNDClosures Completed] WHERE ((([Tbl
FUNDClosures Completed].CompleteDate) Between [Forms]![frm stats closures
date]![Date1] And [Forms]![frm stats closures date]![Date2]));"
Set rst = .OpenRecordset()
End With
Me!FundClosed = rst.Fields("CountOfCompleteDate")
End Sub
Now the problem I am having is that when I try to run the code, it says
Run-time error '3061': Too few parameters. Expected 2.
All the code does is find all the records in Tbl FUNDClosures Completed
which have a completed date between the 2 fields above and returns a count.
I have looked through the code and if I paste it into a query, it works fine.
Any suggestions would be greatly apprecuated.
Kind regards,
Maver1ck666
I have a form where a user inputs a "start date" and "end date" (fields are
called date1 and date2). The form is called frm stats closures date.
When they exit the date2 field, it opens another form which has the
following event procedure on current;
Private Sub Form_Current()
Dim db As Database
Dim rst As Recordset
Dim Qdf As QueryDef
Set db = CurrentDb
Set Qdf = db.CreateQueryDef("")
With Qdf
.SQL = "SELECT Count([Tbl FUNDClosures Completed].CompleteDate) AS
CountOfCompleteDate FROM [Tbl FUNDClosures Completed] WHERE ((([Tbl
FUNDClosures Completed].CompleteDate) Between [Forms]![frm stats closures
date]![Date1] And [Forms]![frm stats closures date]![Date2]));"
Set rst = .OpenRecordset()
End With
Me!FundClosed = rst.Fields("CountOfCompleteDate")
End Sub
Now the problem I am having is that when I try to run the code, it says
Run-time error '3061': Too few parameters. Expected 2.
All the code does is find all the records in Tbl FUNDClosures Completed
which have a completed date between the 2 fields above and returns a count.
I have looked through the code and if I paste it into a query, it works fine.
Any suggestions would be greatly apprecuated.
Kind regards,
Maver1ck666