(VBA CODE)- to clear entered data on a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JennDavila
    New Member
    • Aug 2008
    • 4

    (VBA CODE)- to clear entered data on a form

    Hello,
    Not sure if my title was correct, but here is what I am dealing with. I have created a DB that contains different tables that are linked to a form through combo box's. I have createad a command so that once all the entries are selected in the combo box it will save on to a table. What I want is after I save the entry. I would like for the form to close and clear the data that was entered last. I am no expert on VBA code and I need help.

    ( I believe I am using Access 2000 format)
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    What you describe is possible, but probably not necessary.

    I don't know if you appreciate that you can have a bound form, some or all of whose controls (matching the table's fields) are ComboBoxes.

    This approach would leave you with little or nothing to do.

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      If you only want to be able add a new record with this form, never view existing records, in Form Design View, goto Properties - Data and set Data Entry to Yes.

      In the code behind your button, after the code that saves the record, place this line:

      DoCmd.Close

      Welcome to Bytes!

      Linq ;0)>

      Comment

      • JennDavila
        New Member
        • Aug 2008
        • 4

        #4
        Originally posted by missinglinq
        If you only want to be able add a new record with this form, never view existing records, in Form Design View, goto Properties - Data and set Data Entry to Yes.

        In the code behind your button, after the code that saves the record, place this line:

        DoCmd.Close

        Welcome to Bytes!

        Linq ;0)>

        This was good.It made my form close, and when opened again the fields were clear. I also tried the DoCmd.Restore and it did just the same clearing out my fields without closing my form. Thanks again!!!

        Comment

        Working...