Trouble with rs.Filter not recognizing wildcards (*)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have been searching for the answer to this and can't seem to find
it.

I am trying to apply a filter to a recordset in VBA and it works
perfectly except for when one of the conditions is a wildcard.

Example:
frmFilter has a number of combo boxes from which the user can specify
criteria that will be used in the filter. So say cboName = "*" and my
filter string is is something like this:

[Name] Like '*'

This returns no records...

I have also tried to make the string like this:

[Name] Like "*"

But that doesn't work either.

The first example (using Like with single quotes) seems to work for
everything except when the only thing in the combo box is the
asterisk. If I put any character and an asterisk (ex. D*) in the
combo box it will return records.

Anyone have any ideas on how to fix this?

Thanks,

Anthony Pierdominici

.



Relevant Pages

  • Re: Recordset as Criteria for Form Filter
    ... it opens up only that client, but just to be sure I'm clear, I want to open ... If it's potentially quite long, it may be simplest to just use the same criteria string that was originally specified in opening that recordset, and apply that to the form as a filter when you open it. ... If all you have is the recordset containing the filtered IDs, though, and you can't get the filter string from it, AND the list is fairly short, then you might run through the recordset and build a filter string: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... in the criteria cell in the graphical query builder. ... use as the source in the routine. ... the same filtered recordset every time. ... choose themselves what fields to filter on. ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... should build the SQL, using a query, then paste it into your code. ... the same filtered recordset every time. ... choose themselves what fields to filter on. ... Set MyRS = MyDB.OpenRecordset" ...
    (microsoft.public.access.formscoding)
  • Re: Help with Microsoft help on linking Access to Outlook
    ... and have the query point to the combo box to get its value. ... the same filtered recordset every time. ... choose themselves what fields to filter on. ... Set MyRS = MyDB.OpenRecordset" ...
    (microsoft.public.access.formscoding)
  • RE: "too few parameters expected" when filtering OpenRecordset
    ... the filter line doesn't look right. ... The only solution I know of is to add a column in the query to get the ... into a second recordset and then assign the second recordset to the listbox. ... 'Define the SQL to run the stored proc ...
    (microsoft.public.access.modulesdaovba)