I am trying to run a query from a form with 2 date picker fields for start and end dates and having some problems.
I am getting a datatype conversion error.
Am I missing something? The parameters in the query are defined as Date/Time.
Here is the VBA code.
Thanks
John Fuhrman
I am getting a datatype conversion error.
Am I missing something? The parameters in the query are defined as Date/Time.
Here is the VBA code.
Code:
Private Sub btnOpneNatSecQuery_Click()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
'Debug.Print CDate(Me.DTPStart) & " And " & CDate(Me.dtpEnd)
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("Date Range Pending for National Security with Elapsed Time")
qdf.Parameters("StartDate") = Me.DTPStart.Value
qdf.Parameters("EndDate") = Me.dtpEnd.Value
Set rst = qdf.OpenRecordset("Date Range Pending for National Security with Elapsed Time", dbSeeChanges)
StatusBar ("National Security Cases")
'DoCmd.Close acForm, "National Security Query", acSaveNo
qdf.Close
Set qdt = Nothing
Set dbs = Nothing
End Sub
Thanks
John Fuhrman