Clear Text Box after Command button is pushed

emilyebba

Registered User.
Local time
Today, 09:40
Joined
Sep 26, 2012
Messages
76
Hi,

I have an unbound text box that looks up a report. When you enter in an invoice number into the text box and press the command button it automatically generates a report. My problem is, after you view and close the report, the invoice number is still in the text box. Is there any way to clear it upon pressing the command button initially?

Thank you!
 
On button click at the last line just use buttonName.Value = ""
 
Where would I find this? On the Event Procedure for the Command Button?
 
Okay how is your report run? did you use the Wizard?
 
If you could outline the proper protocol for this that would be great. I have another "search" window that I will need to do the same thing for. You put in a number into the text box, press the command button and then it needs to clear the text entered. Thanks for your prompt reply!!
 
I always use VBA, so had to make sure I gave it right.. So this is what you need to do..

Go to the design view, click on the button and under events you will have On Click.. Click the eclipse button, then the macro window will open,
1. Add a new action...
2. Under its Control name -> put the name of the Text box,
3. Under Property -> Value
4. Under Value -> ""
Save and execute.
 
I beg your pardon I am new to Access :) I understand that I click the "..." button But how do you "Add a new action" ?
 
I am using Access 2003. Im sorry I should have said that. In any case I think I have figured out how to add...there is now a solid line and this is what I have entered:

Private Sub Command27_Click()

Text8.Value = ""

End Sub

I get an error that says:

The expression On Click you entered as the event property setting produced the following error: Ambiguous name detected: Command27_Click

Regarding Mr.Larson's post...where would I put this code? In the event procedure of the command button on Click?
 
Hi,

Thank you for that meaningful advice. I just went through my entire database and renamed all the ambiguous fields.

That code worked great. I have one question though. Is there anyway for it to clear without "clicking" back into the box? You put in the invoice number, then you click the command to retrieve the record, but the number is still in the unbound text box until you "click" back there. This will work (THANK YOU) but I was wondering if there was another way so it would totally just disappear :) Thank you Mr. Larson!!!
 
Do I have to go through the VBA window and delete all the past Command codes that are there? Im trying to figure out where to input your suggestion and I see random Commands? Im totally new at this and trying to learn. Thank you.
 

Users who are viewing this thread

Back
Top Bottom