Consulting

Results 1 to 3 of 3

Thread: Solved: UserForm Help needed

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Solved: UserForm Help needed

    I have this code in the form that giving me problems.

    [VBA]Public FilePath As String
    Private Sub CmdDefault_Enter()
    Call CmdSignOff_Click
    End Sub

    Private Sub CmdGoBack_Click()
    Unload FrmSignatureConfirm
    End Sub

    Private Sub CmdSignOff_Click()

    Dim res As String, res2 As String, ns As String
    res = TxtPassword.Value

    ActiveSheet.Unprotect "kimberly"
    If ButtonNS.Value = True Then
    res2 = "Pochontas1"

    ns = "Nick Smith"

    End If

    If ButtonMJ.Value = True Then
    res2 = "CORAL100"

    ns = "Martin Jones"

    End If
    If ButtonES.Value = True Then
    res2 = "kimbo04"

    ns = "Eddie Santos"

    End If
    If res = res2 Then
    Sheets("Incoming").LblSignConfirm.Caption = ns

    FrmGroup.Show

    '------------------------------Saving In Incoming Confirmations---------------------
    Dim fp As String, strSaveIncoming As String

    FilePath = ""
    'fp = "C:\Depot Incoming\Incoming Confirmations\"
    fp = "S:\Depot Incoming\Incoming Confirmations\"
    Call MakeFolders(fp)
    Call MakeFolders(Range("K2").Value & "\")
    Call MakeFolders(Format(Date, "yyyy") & "\")
    Call MakeFolders(Format(Date, "mmm") & "\")


    Application.DisplayAlerts = False
    strSaveIncoming = Format(Range("I1").Value, "mmddyy") + " Incoming Sheet" + ".xls"
    Application.DisplayAlerts = True

    ActiveWorkbook.SaveAs FilePath & strSaveIncoming, xlWorkbookNormal
    FilePath = ""
    '----------------------------Finishing Saving File----------------------------------
    ActiveSheet.Protect "kimberly"
    Unload FrmSignatureConfirm
    End If
    If res = "" Then
    MsgBox ("Please Enter A Password")
    Me.TxtPassword.SetFocus
    Else
    If res <> res2 Then
    If MsgBox("Please Check User Name and Password!", vbOKCancel, "Password Error!") = vbOK Then
    FrmSignatureConfirm.ButtonES.SetFocus
    SendKeys "{Tab}+"

    Exit Sub

    Else
    Unload FrmSignatureConfirm

    End If
    End If
    End If
    ActiveSheet.Protect "kimberly"
    End Sub
    Private Sub MakeFolders(fp As String)
    FilePath = FilePath & fp
    If Dir(FilePath, vbDirectory) = "" Then MkDir FilePath
    End Sub[/VBA]

    This is a form with names and the person needs to select his/her name and then enter there password. If res = res2 then it should open FrmGroup then save.

    This is the FrmGroup Code

    [VBA]Private Sub CmdGo_Click()

    If FrmGroup.ButtonDepot.Value = True Then Sheets("Incoming").Range("K2").Value = FrmGroup.ButtonDepot.Caption
    If FrmGroup.ButtonMortgage.Value = True Then Sheets("Incoming").Range("K2").Value = FrmGroup.ButtonMortgage.Caption
    If FrmGroup.ButtonPcar.Value = True Then Sheets("Incoming").Range("K2").Value = FrmGroup.ButtonPcar.Caption
    Unload FrmGroup
    End Sub[/VBA]

    Basically this form should come up when the Go button is clicked on FrmSignatureConfirm. What is happening is the FrmSignatureConfirm doesn't even come up it goes straight to FrmGroup. Any help would be great.

  2. #2
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Is your CmdDefault button, the first in the tab order? Youa re using its Enter event to run the signoff code rather than its Click event - is that deliberate?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    rory thanks a ton I had the CmdDefault as 1 in the tab order. That seems to have been the problem.

Posting Permissions

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