SQL Variable Issue

  • Thread starter Thread starter Kurt Abele via AccessMonster.com
  • Start date Start date
K

Kurt Abele via AccessMonster.com

What I am trying to do is when a user clicks the process button I apply a
filter to a list box (which is bound to a form)

So, I took the rowsource for the orig list box and modified it so I could
apply my filter settings and then assigned the new query to the rowsource
of the listbox.

In the query I use a variable to enter the item I want to filter on.

Now, when the rowsource gets assigned - I get a parameter box opening
asking me for a parameter - and the parameter value is the value I am using
in my filter.

Can I turn is off, do it a better way?? Help

Thanks in advance
 
Hi,


Are you writing a VBA statement at a point or at another, something
like:

Me.Filter = "MyFieldName=" & Me.ComboBox

and the specified field is alphanumerical? Then, I would try:

Me.Filter = "MyFieldName='" & Replace(Me.ComboBox, "'", "''" ) &
"'"



if I add extra space to make it more readable:

" MyFieldName=' " & Replace(Me.ComboBox, " ' ", " ' ' " ) & " ' "



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top