LATECHmatt05
Technical User
I am new to access. Right now I have a form with a text box so that the user can enter a date and a query is called from the form and finds a record with that date. I keep getting runtime error 2001 each time I use the form. It is really weird I wonder do I need to edit my query. I will include the code that is executed each time I click the ok button to submit the date. Any help is very much appreciated. Thank you very much.
Private Sub cmdOK_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.QueryDefs("masterq")
strSQL = "SELECT Begin.*" & _
"FROM Begin " & _
"WHERE Begin.date='" & Me.[DateA].Value & " ';"
qdf.sql = strSQL
DoCmd.OpenQuery "masterq"
DoCmd.Close acForm, Me.Name
Set qdf = Nothing
Set db = Nothing
End Sub
My query is not a parameter query is this the problem?
Private Sub cmdOK_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.QueryDefs("masterq")
strSQL = "SELECT Begin.*" & _
"FROM Begin " & _
"WHERE Begin.date='" & Me.[DateA].Value & " ';"
qdf.sql = strSQL
DoCmd.OpenQuery "masterq"
DoCmd.Close acForm, Me.Name
Set qdf = Nothing
Set db = Nothing
End Sub
My query is not a parameter query is this the problem?