Clear Unbound Text box used as input parameter to query

M

Mommybear

I've looked at everything I can find, tried all the suggestions but still
can't get this to work. I have a form that opens blank. You input your
parameter into an unbound text box then press a command button that performs
a requery of the database and returns the results in a continuous form. When
the results are returned, the parameter is listed as part of the detail in
the form so I want the parameter box to be cleared out and ready for the next
one.

My command on the Search button looks like this:

Private Sub SearchEPICode_Click()

Me.Requery

End Sub

I've tried adding Me!InputEPI = Null but nothing works. Am I adding it to
the wrong place.
 
J

John W. Vinson

I've looked at everything I can find, tried all the suggestions but still
can't get this to work. I have a form that opens blank. You input your
parameter into an unbound text box then press a command button that performs
a requery of the database and returns the results in a continuous form. When
the results are returned, the parameter is listed as part of the detail in
the form so I want the parameter box to be cleared out and ready for the next
one.

My command on the Search button looks like this:

Private Sub SearchEPICode_Click()

Me.Requery

End Sub

I've tried adding Me!InputEPI = Null but nothing works. Am I adding it to
the wrong place.

Probably. You don't say where you're adding it!

I presume that the textbox named InputEPI has no Control Source, right? What
do you mean by "the parameter is listed as part of the detail"?
 
B

Beetle

Well, Me!ZInputEPI = Null *should* work, but if it's not
you might try following it with a Me.Repaint. You might
also try;

Me!InputEPI = ""
 
M

Mommybear

That is correct, it does NOT have a control source. The parameter is used to
search a field on my query, when it returns, the query field is displayed on
my form which happens to be the same as the parameter.
 
M

Mommybear

None of these worked. I just want to clarify that I'm putting these on the
command button. Is that where I'm suppose to do this or should it be
someplace else.
 
J

John W. Vinson

None of these worked. I just want to clarify that I'm putting these on the
command button. Is that where I'm suppose to do this or should it be
someplace else.

Please post the names and code of all the relevant controls.
 
J

John W. Vinson

I still can not get this working, can someone please help.

"Doctor, I don't feel good, what should I take?"

As I asked on the 1st (and got no answer):

Please post your code and the names of the relevant controls.
 
M

Mommybear

John, I thought I answered your question. I'm adding this code on the Search
command button, not the unbound text box. My unbound text box is "InputEPI"
and my search button is "SearchEPICode". This is what my command button
looks like:

Private Sub SearchEPICode_Click()

Me.Requery
Me.InputEPI = Null

End Sub
 
J

John W. Vinson

John, I thought I answered your question.

The Microsoft website has been losing a lot of posts... sorry for the lame
attempt at humor; I should have realized it was the web interface messing up
again!
I'm adding this code on the Search
command button, not the unbound text box. My unbound text box is "InputEPI"
and my search button is "SearchEPICode". This is what my command button
looks like:

Private Sub SearchEPICode_Click()

Me.Requery
Me.InputEPI = Null

End Sub

And it's not making InputEPI go blank? That's odd. Try adding a line

Me.Repaint

after the =Null line.
 
M

Mommybear

Not a problem. I'm new to this so I wasn't sure if my answer was actually
what you were looking for.

I tried the Repaint too and that didn't work. I did notice yesterday while
experimenting that it looks like it is not doing the code but instead is
running an embedded macro which turns on the hourglass while runnung. Not
sure how to change this to run the VBA code.
In addition to resetting this field after the form populates, I would also
eventually like to reset the whole form when I click the search command
button. But one step at a time.
 
J

John W. Vinson

I tried the Repaint too and that didn't work. I did notice yesterday while
experimenting that it looks like it is not doing the code but instead is
running an embedded macro which turns on the hourglass while runnung. Not
sure how to change this to run the VBA code.
In addition to resetting this field after the form populates, I would also
eventually like to reset the whole form when I click the search command
button. But one step at a time.

If you open the form in design view and look at its Properties, what is on
this event's line? For the code to run it should be [Event Procedure]. Try
deleting the macro and changing it to that.
 
M

Mommybear

When I do this, nothing happens. It just sits and stares at me. I just
don't get it.

John W. Vinson said:
I tried the Repaint too and that didn't work. I did notice yesterday while
experimenting that it looks like it is not doing the code but instead is
running an embedded macro which turns on the hourglass while runnung. Not
sure how to change this to run the VBA code.
In addition to resetting this field after the form populates, I would also
eventually like to reset the whole form when I click the search command
button. But one step at a time.

If you open the form in design view and look at its Properties, what is on
this event's line? For the code to run it should be [Event Procedure]. Try
deleting the macro and changing it to that.
 
M

Mommybear

I finally got it to work. Apparently, my VBA code wasn't running because of
a security setting couldn't be enabled. Now that I got that figured out,
this works great. Thank you for all your help and understanding.

Mommybear said:
When I do this, nothing happens. It just sits and stares at me. I just
don't get it.

John W. Vinson said:
I tried the Repaint too and that didn't work. I did notice yesterday while
experimenting that it looks like it is not doing the code but instead is
running an embedded macro which turns on the hourglass while runnung. Not
sure how to change this to run the VBA code.
In addition to resetting this field after the form populates, I would also
eventually like to reset the whole form when I click the search command
button. But one step at a time.

If you open the form in design view and look at its Properties, what is on
this event's line? For the code to run it should be [Event Procedure]. Try
deleting the macro and changing it to that.
 

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

Top