How do you recycle a query?

  • Thread starter Thread starter Scott Shively
  • Start date Start date
S

Scott Shively

Hi,

I have a form controlled by a name query. When you open the form, a text box
appears asking you to enter the client's last name. Then the form displays
everyone that matches that last name.

How do I modify the form/query so that once you're through with that client
you get the text box back again so that you can enter a different name and
start the process all over again? Right now you have to close the form and
open it again.

Thank you,

Scott
 
Scott Shively said:
Hi,

I have a form controlled by a name query. When you open the form, a text box
appears asking you to enter the client's last name. Then the form displays
everyone that matches that last name.

How do I modify the form/query so that once you're through with that client
you get the text box back again so that you can enter a different name and
start the process all over again? Right now you have to close the form and
open it again.

I would get rid of the parameter in the query entirely. Just add an
unbound ComboBox to the form that displays all of the possible Last Names
and in the AfterUpdate event use the selection to apply a filter to the
form.

Me.Filter = Me.ComboBoxName
Me.FilterOn = True
 
Rick Brandt said:
I would get rid of the parameter in the query entirely. Just add an
unbound ComboBox to the form that displays all of the possible Last Names
and in the AfterUpdate event use the selection to apply a filter to the
form.

Me.Filter = Me.ComboBoxName
Me.FilterOn = True

Sorry, should be....

Me.Filter = "ClientLastNameField = '" & Me.ComboBoxName & "'"
Me.FilterOn = True
 
-----Original Message-----
Hi,

I have a form controlled by a name query. When you open the form, a text box
appears asking you to enter the client's last name. Then the form displays
everyone that matches that last name.

How do I modify the form/query so that once you're through with that client
you get the text box back again so that you can enter a different name and
start the process all over again? Right now you have to close the form and
open it again.

Thank you,

Scott


.



Scott,

There a couple of ways you could do this. Here is one.
This involves placing everything directly on your form.
place two command buttons on your form and a text box on
your form. call one Reset, and the other Search. In the
onclick event for Reset, put this in the code..

me.textbox = ""

for the Search button, put this in the onclick event..

docmd.requery "queryname"
 
Hi,

I grasp the concept, but I'm really struggling with the mechanics.

1. I'm getting a compile error on the 'me.textbox = "" ' statement - 'Method
or data member not found' on the Reset Command button. The only instruction
I put in the OnClick event is the one you gave me. Do I need to add
something else.

2. What do I do with the text box? I put it on the form but that was it. I
didn't name it or change any other properties.

3. I'm getting a run time error 2109 (no field named 'Name Search') which is
the name of my query on the Search Command button onclick event. I tried
putting the name in brackets within the quotes but that had no impact. I
also tried setting the Control Source on my form to the table and then to my
query but that seems to have no impact either. I keep getting the 2109
error.
 
Back
Top