M
Manuel
I have a table which stores SQL statements as strings. I'm trying to filter
the table for a particular SQL string in VBA.
The code fails at: Set rst = db.OpenRecordset(strSQL). I get Run-time
error: 3075. The error message indicates that I'm missing an operator.
The code is below. The fstrWhere variable returned by the GetWhereClause
function equals:
"WHERE [UserID]= 'KZ1' AND ([ActualSaleDt] Between #8/1/2008# And #8/31/2008#)
Function CkFiltExists(bln As Boolean, FiltNm As String)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer
Dim strSQL As String
Dim fstrWhere As String
Call GetWhereClause(fstrWhere)
strSQL = "SELECT * From tbl_UserFilters WHERE (([WhereClause]) = '" &
fstrWhere & "')"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
i = rst.RecordCount
If i > 0 Then
bln = True
FiltNm = rst("ShortDesc").Value
Else
bln = False
End If
rst.Close
End Function
In the immediate window, strSQL contains:
SELECT * From tbl_UserFilters WHERE (([WhereClause]) = 'WHERE [UserID]=
'KZ1' AND ([ActualSaleDt] Between #8/1/2008# And #8/31/2008#)'
Anyone know what I'm doing wrong.
Thanks,
Manuel
the table for a particular SQL string in VBA.
The code fails at: Set rst = db.OpenRecordset(strSQL). I get Run-time
error: 3075. The error message indicates that I'm missing an operator.
The code is below. The fstrWhere variable returned by the GetWhereClause
function equals:
"WHERE [UserID]= 'KZ1' AND ([ActualSaleDt] Between #8/1/2008# And #8/31/2008#)
Function CkFiltExists(bln As Boolean, FiltNm As String)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer
Dim strSQL As String
Dim fstrWhere As String
Call GetWhereClause(fstrWhere)
strSQL = "SELECT * From tbl_UserFilters WHERE (([WhereClause]) = '" &
fstrWhere & "')"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
i = rst.RecordCount
If i > 0 Then
bln = True
FiltNm = rst("ShortDesc").Value
Else
bln = False
End If
rst.Close
End Function
In the immediate window, strSQL contains:
SELECT * From tbl_UserFilters WHERE (([WhereClause]) = 'WHERE [UserID]=
'KZ1' AND ([ActualSaleDt] Between #8/1/2008# And #8/31/2008#)'
Anyone know what I'm doing wrong.
Thanks,
Manuel