VBA Filtering

  • Thread starter Thread starter Matthew DeAngelis
  • Start date Start date
M

Matthew DeAngelis

Hello again,

I am having some trouble with VBA code that I do not think I can solve
on my own (I'm not very good with the stuff).

Basically, I am trying to see if I can use the same form to both list
all of the companies in the database and to search for a specific
company. I am trying to apply a filter in code to accomplish this.
This is a code snippet from the command button:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm: AllCompanies"
stLinkCriteria = "Forms![frm: AllCompanies]!Company = '*' & [Enter
Company Here] & '*'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

I am not sure what is wrong. The [Enter Company Here] prompt comes up,
I type in the first company in the database, but the form opens on a
blank record (1 of 1) (Filtered). Does anyone know what is wrong with
my link criteria statement?


Thanks,
Matt
 
Douglas said:
Try changing the = to the word Like.

Oh, indeed. I should have been able to figure that one out myself.

Thanks very much :)
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top