Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to clear an unbound form

How to clear an unbound form

How to clear an unbound form

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

RE: How to clear an unbound form

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

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

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


Ricky Hicks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close