do you mean :
erase the data?
or
or close the datasheet? (theres a close button on the app for this)
I mean "we need a button that will CLEAR the information from the form screen." without changing the data in the table. Allowing the user to enter in another model number. Currently, the datasheet has to close in order for new data to appear in it the next time the form is used.
Thank you
What new data? Does the 'Run Query' button do a data insert?Currently, the datasheet has to close in order for new data to appear in it the next time the form is used.
When we ask for clarification, merely repeating yourself does not clarify your need. Do you mean that you want to put another button on the Mod Search Form that will blank out the "KGS Model:" textbox?"we need a button that will CLEAR the information from the form screen."
That shouldn't be necessary. Code can be added to the 'Run Query' button that will do that after the query is fired off.
OR do you mean that with the situation shown in your post, you want to enter a new KGS Model, press the Run Query button and the existing query display disappears and a new one pops up with the new KGS Model information?
OR something else?
Are you using macros or VBA?
So many ways to skin a cat as the saying goes. Same here.
Why not enter a new value, click the existing button and requery the datasheet - assuming that's what you meant by a "query form" in one instance, and "datasheet" in another?
Or change the textbox to a combo and use its AfterUpdate event to requery the datasheet since the entered value must be in a table anyway.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
I would use a combo box because you wouldn't have to enter an exact match before you saw the model you want.
Whether you use a combo box, list box or a text box, it would have to be unbound. The last line of the subroutine would be
(change ControlName to the name of your control)Code:Me.ControlName = Null
I apologize for the confusion.
This is a search form linked to a query with an unbound text box.
After a model number is entered and the Run Query button is clicked on, the results appear in a Query datasheet.
Currently, in order to run another model number, the user must close the data sheet, then clear out or write over the number in the text box.
I would like to add a 'Clear' button that will clear/erase the previously entered number from the text box.
I used the wizard to create a button (called 'Clear'), with the Category set to Record Operations and the Actions set to Undo Record. However, this does not apparently work.
Any suggestions...
davegri_test1.zip
This should get you there.
Nice solution, davegri. A one button form with a test for the textbox not being empty would be another way (not necessarily better).
Code:Private Sub cmb_search_Click() If txtModelSearch <> "" Or Not IsNull(txtModelSearch) Then DoCmd.Close acQuery, "qModelSearch" End If If DCount("*", "qModelSearch") > 0 Then DoCmd.OpenQuery "qModelSearch", , acReadOnly Else MsgBox "This search has no records, try again" End If End Sub