S
Steve
Could any of you "kind and generous guys" explain what
I've done wrong, I get error messages indicating that the
problem lies within the WHERE clause. I'm trying to adapt
an example from a book. I'm using Access 2002 and DAO.
Any help would be appreciated.
Function BuildSQLString(ByRef strSQL As String) As Boolean
Dim strSELECT As String
Dim strFROM As String
Dim strWHERE As String
strSELECT = "SELECT
s.*.*" 'set the columns to
return results from
'(all columns
in this case)
'set an alias "h" for HRBaseTbl
strFROM = "FROM HRBaseTbl As h "
If chkFirstNameID Then
'check for 2nd or more WHERE term
If strWHERE <> " " Then strWHERE = strWHERE & " AND "
strWHERE = strWHERE & "h.HRID = " & cboFirstNameID
End If
If chkSurnameID Then
'check for 2nd or more WHERE term
If strWHERE <> " " Then strWHERE = strWHERE & " AND "
strWHERE = strWHERE & "h.HRID = " & cboSurnameID
End If
I've done wrong, I get error messages indicating that the
problem lies within the WHERE clause. I'm trying to adapt
an example from a book. I'm using Access 2002 and DAO.
Any help would be appreciated.
Function BuildSQLString(ByRef strSQL As String) As Boolean
Dim strSELECT As String
Dim strFROM As String
Dim strWHERE As String
strSELECT = "SELECT
s.*.*" 'set the columns to
return results from
'(all columns
in this case)
'set an alias "h" for HRBaseTbl
strFROM = "FROM HRBaseTbl As h "
If chkFirstNameID Then
'check for 2nd or more WHERE term
If strWHERE <> " " Then strWHERE = strWHERE & " AND "
strWHERE = strWHERE & "h.HRID = " & cboFirstNameID
End If
If chkSurnameID Then
'check for 2nd or more WHERE term
If strWHERE <> " " Then strWHERE = strWHERE & " AND "
strWHERE = strWHERE & "h.HRID = " & cboSurnameID
End If