Consulting

Results 1 to 4 of 4

Thread: Saving information from the user form

  1. #1
    VBAX Regular
    Joined
    Feb 2015
    Posts
    8
    Location

    Saving information from the user form

    Hi guys,

    I have a user form with lots of textboxes that gather the user inputs. When the user presses cmdOK it closes the current userform and populates the next one. On the next form I have a "back" button which unloads the current form and shows the previous one. However, the previous form comes up empty... Is there a way to save the information entered on the previous form so that when the user chooses to go back its pre-populated? Your advise is much appreciated!

  2. #2
    Hi cal911.
    You can use userform.hide when closing first userform(unload it later) or dump textbox values to public variables or cells.

  3. #3
    VBAX Regular
    Joined
    Feb 2015
    Posts
    8
    Location
    Quote Originally Posted by Wizwyrm View Post
    Hi cal911.
    You can use userform.hide when closing first userform(unload it later) or dump textbox values to public variables or cells.
    Can you please elaborate? I have 6 consecutive forms each feeding the info into the next one and I put back buttons on each one of them...

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    in cmdOK buttons' click events use;
    UserFormX.Hide rather than Unload UserFormX

    in cmdBACK buttons' click events use;
    UserFormX.Show rather than Load UserFormX

    Private Sub cmdOK_Click()
        Me.Hide
        UserFormNext.Show
    End Sub
    
    Private Sub cmdBACK_Click()
        Me.Hide
        UserFormPrevious.Show
    End Sub
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •