G
Guest
Hi,
I am having problems with the WHERE clause:
Sub SetupWordTemplate(frmFilter As Form_frmX)
Dim rst As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT ID, Type, Description, Purpose, " & _
"Contract, Required, [Date Reqd] FROM qryGfpFormatted " & _
"WHERE Contract LIKE " & "'some_string'"
rst.Open strSQL, CurrentProject.Connection
If some_string is replaced by the characters that match characters in the
field Contract, then all is ok. But if some_string is replaced by * then a
syntax error results:
i.e. "WHERE Contract LIKE " & "'*'" then syntax error results
What I really want to do is replace some_string by a reference to a combo
box that can include exact match to Contract or contain an * or a few
characters followed by an *.
i.e. "WHERE Contract LIKE " & "'frmFilter.cboContract'"
Appreciate any help.
John
I am having problems with the WHERE clause:
Sub SetupWordTemplate(frmFilter As Form_frmX)
Dim rst As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT ID, Type, Description, Purpose, " & _
"Contract, Required, [Date Reqd] FROM qryGfpFormatted " & _
"WHERE Contract LIKE " & "'some_string'"
rst.Open strSQL, CurrentProject.Connection
If some_string is replaced by the characters that match characters in the
field Contract, then all is ok. But if some_string is replaced by * then a
syntax error results:
i.e. "WHERE Contract LIKE " & "'*'" then syntax error results
What I really want to do is replace some_string by a reference to a combo
box that can include exact match to Contract or contain an * or a few
characters followed by an *.
i.e. "WHERE Contract LIKE " & "'frmFilter.cboContract'"
Appreciate any help.
John