Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch Error 13

Status
Not open for further replies.

akins4lyfe

Programmer
Oct 6, 2010
39
GB
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
 
Try add some double quotes and get rid of some spaces:
Code:
Dim strSQL As String
strSQL = "SELECT [First Name], [LastName]"
strSQL = strSQL & " FROM tblMember"
strSQL = strSQL & " WHERE [First Name] Like ""*" & [Forms]![frmFindMemberDetails]![txtFirstName] & "*"" "
strSQL = strSQL & " AND [Last Name] Like ""*" & [Forms]![frmFindMemberDetails]![txtSurname] & "*"" "

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top