48Highlander
Technical User
I need to add "filterdesc" to the WHERE clause of an existing query. The code I have so far is giving me a 'type mismatch' error on the open recordset statement. "strqueryname" is a string variable containing the name of the saved query.
What am I doing wrong?
Bill J
Code:
Dim db As Database
Dim rs As Recordset
Dim nbr As Integer
Dim strNumber As String
Dim tempQuery As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
Set tempQuery = db.QueryDefs("strqueryname")
If Me.cboReportSelected = 41 Then
strSQL = tempQuery.SQL
strSQL = strSQL & " AND " & FilterDesc
tempQuery.SQL = strSQL
Else
strSQL = tempQuery.SQL
tempQuery.SQL = strSQL
End If
Set rs = db.OpenRecordset(tempQuery, dbOpenDynaset)
What am I doing wrong?
Bill J