G
Guest
I had to build a query to which a form is bound in order to view data based
on criteria that I could not get to work any other way.
The qurey takes [VehicleNumber] and limits the query to the specific
vehicle, then takes [txtStartDate] and [TxtEndDate] and searches for entries
between these two dates.
What I now want to do, is check to see if there are any records before
running DoCmd.OpenForm.
What I have tried is this:
-----------------------------
Dim stDocName As String
Dim db As DAO.Database
Dim rst As Dao.RecordSet
Set db = Currentdb()
stDocName = "frmDispositionHistory'
--
If & Else If statements here to check that txtStartDate and txtEndDate are
entered
--
Set rst = db.OpenRecordSet("qrySearchDispositions")
If rst.RecordCount > 0 Then
DoCmd.OpenForm stDocName
Exit Sub
Else
MsgBox("blah blah....")
Exit Sub
End If
-----------------------------------------
When I click the button to begin the search, I get an error message :Too few
parameters, expecting 3
Any help is appreciated....
on criteria that I could not get to work any other way.
The qurey takes [VehicleNumber] and limits the query to the specific
vehicle, then takes [txtStartDate] and [TxtEndDate] and searches for entries
between these two dates.
What I now want to do, is check to see if there are any records before
running DoCmd.OpenForm.
What I have tried is this:
-----------------------------
Dim stDocName As String
Dim db As DAO.Database
Dim rst As Dao.RecordSet
Set db = Currentdb()
stDocName = "frmDispositionHistory'
--
If & Else If statements here to check that txtStartDate and txtEndDate are
entered
--
Set rst = db.OpenRecordSet("qrySearchDispositions")
If rst.RecordCount > 0 Then
DoCmd.OpenForm stDocName
Exit Sub
Else
MsgBox("blah blah....")
Exit Sub
End If
-----------------------------------------
When I click the button to begin the search, I get an error message :Too few
parameters, expecting 3
Any help is appreciated....