I am trying to use a form to select certain criteria and amend a query depending on those selections. The form is shown when my access database first starts up and i have 3 criteria:
Date
Database
Release
These are then used to query a table and amend the query appropriately. Using various sources on the internet i have produced the following code in VBA. However i seem to be getting a type mismatch. The code is as follows:
Dim db As DAO.Database
Dim qdf As DAO.QueryDefs
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qryMemAll")
strSQL = "SELECT tblDetails.* " & _
"FROM tblDetails " & _
"WHERE tblDetails.Run Date='" & Me.cboDate.Value & "' " & _
"AND tblDetails.Database Name='" & Me.cboDB.Value & "' " & _
"AND tblDetails.Release='" & Me.cboRelease.Value & "' "
qdf.SQL = strSQL
DoCmd.OpenQuery "qryMemAll"
DoCmd.Close acForm, Me.Name
Set qdf = Nothing
Set db = Nothing
Also it doesnt seem to like the qdf.SQL statement. Any help will be greatly appreciated. thanks in advance.
Swills
Date
Database
Release
These are then used to query a table and amend the query appropriately. Using various sources on the internet i have produced the following code in VBA. However i seem to be getting a type mismatch. The code is as follows:
Dim db As DAO.Database
Dim qdf As DAO.QueryDefs
Dim strSQL As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qryMemAll")
strSQL = "SELECT tblDetails.* " & _
"FROM tblDetails " & _
"WHERE tblDetails.Run Date='" & Me.cboDate.Value & "' " & _
"AND tblDetails.Database Name='" & Me.cboDB.Value & "' " & _
"AND tblDetails.Release='" & Me.cboRelease.Value & "' "
qdf.SQL = strSQL
DoCmd.OpenQuery "qryMemAll"
DoCmd.Close acForm, Me.Name
Set qdf = Nothing
Set db = Nothing
Also it doesnt seem to like the qdf.SQL statement. Any help will be greatly appreciated. thanks in advance.
Swills