Programmatically entering query criteria on Form

  • Thread starter Thread starter Gwen
  • Start date Start date
G

Gwen

Please help

I have written code to dynamcially enter information in
text boxes when the form opens to be used as criteria for
a query. However the query is not getting the info. When
I manually enter the info in the text box the query runs.
What am I missing ? Below is the snippet of code:

For i = 0 To usr.Groups.Count - 1
grpname = usr.Groups(i).Name
strcriteria = strcriteria & "= """ & grpname & """ or "
strcriteria = strcriteria & varname
Next i

Me.criteria = strcriteria

thanks

Gwen
 
Hi

What triggers the query to run? I'm guessing its the
textbox After_Update event which will fire when you
manually enter data into it on the form, but not when you
change the value from code. You will need to add code to
run the query after you've changed the value from code.

hth

Chris
 
Back
Top