Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clear an unbound form 1

Status
Not open for further replies.

montyb

Technical User
Sep 8, 2000
26
0
0
US
I have an unbound form that I enter a range of numbers (and other data) to populate a table. I use a command button to populate the data. When the button is pushed, how do I get the form to clear, so I can enter the next range of data?

I used to write code for another command button to clear a form (but those were bound forms). Here is the code I used

Private Sub Command_Click()
If me.dirty then me.undo
End Sub

This code does not work for the unbound form. What do I need to do?

Thanks in advance [sig][/sig]
 
Me.Undo will only work if the controls are bound. You will need to build a sub routine to set all the controls to Null.

You can use:
Me.YourControl_1 = Null
Me.YourControl_2 = Null
Me.YourControl_3 = Null.......ect

Or:
Me.YourControl_1 = ""
Me.YourControl_2 = ""
Me.YourControl_3 = "" .......ect

This will have to be done to each control you want to clear.

HTH X-)
RDH [sig]<p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top