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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Combobox Rowsource Wildcard

Status
Not open for further replies.

SeadnaS

Programmer
May 30, 2011
214
Me![sizecombo].RowSource = "SELECT DISTINCT Size_Type FROM " & Me!classcombo & " WHERE Size_Type LIKE " & Me!classcombo & "_" & Me!type & "_*;"

I want a wildcard! Why does the * symbol not work as a wild card here?
 
Is there an alternative way to do what I want here? I want to limit the results of my combo box to records that contain (Me!type) and (Me!classcombo) the wildcard replaces numbers and they are different for a lot of the records. I don't see why I cant use a wild card here.
 
Try change you code so that it can be debugged:
Code:
Dim strSQL As String
strSQL = "SELECT DISTINCT Size_Type FROM " & Me!classcombo & _
  " WHERE Size_Type LIKE " & Me!classcombo & "_" & Me!type & "_*;"
debug.print strSQL
Me![sizecombo].RowSource = strSQL
You can set a breakpoint in your code so you can copy the strSQL value from the debug window and paste it into a new, blank query SQL view.

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

Part and Inventory Search

Sponsor

Back
Top