akins4lyfe
Programmer
Pls assist,
I have a SQL query with wild card criteria. I am Using the SQL with VBA Codes. I want users to type in values into text boxes on a form, then populate a list box with related values (if available) from query results.
I am getting the Type Mismatch error 13 when i do the search. Pls Assist, explanations and help is highly appreciated
here is my code:
Me.lstMembers.BackColor = vbButtonFace
Me.lstMembers.ColumnHeads = True
Me.lstMembers.ColumnCount = 3
Me.lstMembers.ColumnWidths = "3cm; 3cm; 3cm;"
Me.lstMembers.RowSourceType = "Table/Query"
Dim strSQL As String
strSQL = "SELECT tblMember.[First Name], tblMember.[LastName]"
strSQL = strSQL & " FROM tblMember"
strSQL = strSQL & " WHERE (((tblMember.[First Name]) Like " * " & [Forms]![frmFindMemberDetails]![txtFirstName] & " * ") "
strSQL = strSQL & " AND ((tblMember.[Last Name]) Like " * " & [Forms]![frmFindMemberDetails]![txtSurname] & " * "));"
Me.lstMembers.RowSource = strSQL
Thank You
I have a SQL query with wild card criteria. I am Using the SQL with VBA Codes. I want users to type in values into text boxes on a form, then populate a list box with related values (if available) from query results.
I am getting the Type Mismatch error 13 when i do the search. Pls Assist, explanations and help is highly appreciated
here is my code:
Me.lstMembers.BackColor = vbButtonFace
Me.lstMembers.ColumnHeads = True
Me.lstMembers.ColumnCount = 3
Me.lstMembers.ColumnWidths = "3cm; 3cm; 3cm;"
Me.lstMembers.RowSourceType = "Table/Query"
Dim strSQL As String
strSQL = "SELECT tblMember.[First Name], tblMember.[LastName]"
strSQL = strSQL & " FROM tblMember"
strSQL = strSQL & " WHERE (((tblMember.[First Name]) Like " * " & [Forms]![frmFindMemberDetails]![txtFirstName] & " * ") "
strSQL = strSQL & " AND ((tblMember.[Last Name]) Like " * " & [Forms]![frmFindMemberDetails]![txtSurname] & " * "));"
Me.lstMembers.RowSource = strSQL
Thank You