+ Reply to Thread
Results 1 to 2 of 2

Going back on a user form

  1. #1
    Registered User
    Join Date
    10-24-2005
    Posts
    55

    Going back on a user form

    Hi

    I have 3user form. 1 is for name, address, telephone number etc 2 is for the description of the product and the 3 is for price. But on form 2 and 3 I want to have a back button (this is if a user inputs data then presses the button then realised they have forgotten some info) they can click the button and re-edit. But at present when you press the command buttons on the forms the info in the text boxes (name, address, description etc) gets sent to the worksheet cells or textboxes on that worksheet.

    Is it possible to attach code to a command button that would send the info back to the user form for editing again?

    The last form prints the order then the whole process starts again

    I use the code below at present to send the info

    Private Sub CommandButton1_Click()
    Dim LastRow As Range
    Set LastRow = Sheets("Sheet3").Range("A65536").End(xlUp)

    Worksheets("Sheet3").Range("b3") = TextBox1
    Worksheets("Sheet3").Range("b4") = TextBox2
    Worksheets("Sheet3").Range("b5") = TextBox3
    Worksheets("Sheet3").Range("b7") = TextBox5
    Worksheets("Sheet3").Range("b8") = TextBox6
    Worksheets("sheet3").Range("b14") = TextBox7

    If TextBox1 = vbNullString Then
    MsgBox "Name is empty, please complete."
    TextBox1.SetFocus
    Exit Sub
    End If
    If TextBox3 = vbNullString Then
    MsgBox "Telelphone is empty, please compelete."
    TextBox1.SetFocus
    Exit Sub
    End If
    If ComboBox1.Value = "Please select" Then
    MsgBox "Please select Order Type"
    ComboBox1.SetFocus
    Exit Sub
    End If


    Unload Me
    Rom2.Show

    End Sub


    Many thanks

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    As part of the code to the Back button use

    Please Login or Register  to view this content.
    Add additional code for eachtext box

    I also suggestion to test before writing to the sheet

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1