Sorting Data and Clearing User Form Fields

  • Hello,

    In my spreadsheet, after adding data into the form fields, I am supposed to click on 'Add New Record' and the data will be written to Sheet 2. At the same time, the data in Sheet 2 will be sorted into Last_Name alphabetical order and the fields on the form will be cleared ready for the next set of data to be entered.

    This was working correctly in the previous version of the same spread sheet.

    In the current version of the spread sheet, I have added 12 fields to the data form, and reorganised the tab order. I have methodically gone over the code and updated the cell references to reflect the changes. Now I've done this I can still:

    • Write a new record using the form, and have the new data show in the correct columns on Sheet 2
    • Search for and edit a record correctly
    • Search for and delete a record correctly

    For a reason I can't fathom however I cannot now:

    • Make the data in Sheet 2 sort Last_Name in alphabetical order
    • Clear the fields on the data form after adding or editing a new record

    When adding a new record the following error message appears: "error 1004 application defined or object defined error"

    Can anyone help me identify and fix the problem? The spread sheet is attached. The code relating to adding a new record is below.

    Thank you very much for your help.

    P.s. The password for the VBA code is 'Travel'

  • this line produces the error.

    Addme.Offset(0, 47).Value = Me.Receipt_Collected

    the Receipt_Collected combobox in the add new record form says (Combobox7)
    but it exists somewhere else.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!