Filter statement asks for parameter entry

XV1957

Registered User.
Local time
Today, 18:37
Joined
Aug 6, 2014
Messages
80
Can anybody help me with a filtering issue?
I have a bound form, in its heading I have a combo box which lists three choices. Basically I want to filter all my purchase records by checking a field PUOrderNb (Example: PO200100025) against the choice made in the combo box, namely DE (for demand), PO (for Purchase order) etc.

On the after update event of the combo box, I have the following code:
Dim strfilter As String
strfilter = " left ([PuOrderNb],2) like " & cboFilter.Column(1)
Me.Filter = strfilter
Me.FilterOn = True

When I make a choice in the combo box, I get a window asking me to enter a parameter value and it lists the value of the combo box choice as a sort of a title just above the white input fame.
When I type in PO for instance, the program does correctly filter all order numbers starting with PO, but the whole point of having a combo box is not to have to type anything.

The other odd thing is, when I change the choice in the combo box, after my first choice, I do not get this parameter question but nothing happens as to filtering. The first choice remains active.

Thanks for your help.
 
Looks like your value is text, so try:

strfilter = " left ([PuOrderNb],2) = '" & cboFilter.Column(1) & "'"

I changed Like to = since you aren't using a wildcard.
 
Hi Paul,
thank you so much for coming up with the solution so fast.
I implemented the change and of course it worked right away.
I do not know how we could progress so fast without the help of all the expert volunteers at this forum.
 

Users who are viewing this thread

Back
Top Bottom