+ Reply to Thread
Results 1 to 3 of 3

Uncle Uncle Uncle.. I give .. I'm in Userform Pergatory...

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    3

    Uncle Uncle Uncle.. I give .. I'm in Userform Pergatory...

    I have been diligently working on creating a userform for a week now and I have learned a great deal.. what I mostly learned was that I don’t much.. But none the less I forged ahead. I was able to accomplish a fair amount via the web not so much MS site but other searches that gave me a great base to learn from. Well I have hit my limit of learning and now I need to turn to the professionals for my last ditch effort. Here is a list of things I’d like my form to do:
    1. Ability to navigate between next and previous records via buttons – this I have researched and have found some great source but my limited VB scripting has me a bit in the dark as to what variable to change.
    2. Ability to word wrap automatically, for some reason I cannot get my text box to wordwrap when it reached the end of the text box itself.
    3. Ability to update/modify an existing record
    4. Ability to print directly from the form using a print button
    5. Ability to search for a record
    6. A drop down box gives me the ability to select from 3 different choices (Pass, Fail or Deferred)
    That’s it I hope I am very grateful to anyone who can assist me. I am copying my VB code into the body of the post unfortunately I cannot upload my actual file from work.

    Private Sub Label1_Click()

    End Sub

    Private Sub CommandButton1_Click()

    End Sub

    Private Sub Cmd_Clear_Click()
    'Unload Me
    For Each ctl In Me.Controls
    If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
    ctl.Value = ""
    ElseIf TypeName(ctl) = "CheckBox" Then
    ctl.Value = False
    End If
    Next ctl
    End Sub

    Private Sub CMD_Nxt_Click()
    With Sheets("Database").Range("B7:B600")
    Debug.Print TxtAssetNo.Value
    Set c = .Find(TxtAssetNo.Value, LookIn:=xlValues)
    If Not c Is Nothing Then
    firstAddress = c.Address
    Do
    currow = c.Row
    Set c = .FindNext(c)
    Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
    End With
    Debug.Print currow
    currow = currow + 1

    TxtAssetNo = Range("B" & currow).Value
    TxtboxSupp = Range("C" & currow).Value
    TxtboxInvNo = Range("D" & currow).Value
    End Sub





    Private Sub CMD_Prev_Click()

    With Sheets("One_Review_Data").Range("A1:A600")
    Debug.Print Txt_WON.Value
    Set c = .Find(Me.Txt_WON.Value, LookIn:=xlValues)
    If Not c Is Nothing Then
    ' firstAddress = c.Address
    ' Do
    currow = c.Row
    Debug.Print currow
    ' Set c = .FindNext(c)
    ' Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
    currow = currow - 7 ' this will show prevous cell

    Txt_WON.Value
    End With
    'etc....
    End Sub

    Private Sub CMD_submit_Click()
    Dim ctl As Control

    Dim rowcount As Long
    rowcount = Worksheets("One_Review_Data").Range("A1").CurrentRegion.Rows.Count
    With Worksheets("One_Review_Data").Range("A1")
    .Offset(rowcount, 0).Value = Me.Txt_WON.Value
    .Offset(rowcount, 1).Value = Me.Txt_WO.Value
    .Offset(rowcount, 2).Value = Me.Txt_WOM.Value
    .Offset(rowcount, 3).Value = Me.Txt_WOG.Value
    .Offset(rowcount, 4).Value = Me.Txt_WOMa.Value
    .Offset(rowcount, 5).Value = Me.Txt_WOIP.Value
    .Offset(rowcount, 6).Value = Me.Txt_WOE.Value
    .Offset(rowcount, 7).Value = Me.Txt_WOEE.Value
    .Offset(rowcount, 8).Value = Me.Txt_WOT.Value
    End With

    If Me.Txt_WON.Value = "" Then
    MsgBox "Please enter workorder number first.", vbExclamation, "Work Order Number"
    Me.Txt_WON.SetFocus
    Exit Sub
    End If
    If Not IsNumeric(Me.Txt_WON.Value) Then
    MsgBox "This box must contain number.", vbExclamation, "Work Order Number"
    Me.Txt_WON.SetFocus
    Exit Sub
    End If

    If Me.Txt_WOE.Value = "" Then
    MsgBox "Please enter Engineers full name.", vbExclamation, "Work Order Number"
    Me.Txt_WOE.SetFocus
    Exit Sub
    End If
    If Me.Txt_WOT.Value = "" Then
    MsgBox "Please enter Work Order Title.", vbExclamation, "Work Order Number"
    Me.Txt_WOT.SetFocus
    Exit Sub
    End If
    If Me.Txt_WOEE.Value = "" Then
    MsgBox "Please enter email.", vbExclamation, "Work Order Number"
    Me.Txt_WOEE.SetFocus
    Exit Sub
    End If
    For Each ctl In Me.Controls
    If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
    ctl.Value = ""
    ElseIf TypeName(ctl) = "CheckBox" Then
    ctl.Value = False
    End If
    Next ctl
    End Sub

    Function ValidateEmail(ByVal sEmail As String) As Boolean

    Dim oRegularExpression As RegExp

    ' Sets the regular expression object
    Set oRegularExpression = New RegExp

    With oRegularExpression
    ' Sets the regular expression pattern
    .Pattern = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"

    ' Ignores case
    .IgnoreCase = True

    ' Test email string
    ValidateEmail = .Test(sEmail)
    End With

    End Function


    Private Sub Txt_WON_Change()

    End Sub

    Private Sub UserForm_Click()
    Me.PrintForm
    End Sub


    Thank you,

    ~r

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Uncle Uncle Uncle.. I give .. I'm in Userform Pergatory...

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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