+ Reply to Thread
Results 1 to 5 of 5

Couple of Userform, Change event queries

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-05-2008
    Location
    UK
    Posts
    103

    Couple of Userform, Change event queries

    Hi,

    Still basic to VBA, however managed to cobble together my workbook with the functionality I need bar a few missing bits.

    Please see attached
    PC.xlsm

    I have the petty cash sheet to recall Login_Form when clicking cell in Row W. However I need it to insert the username into active cell.

    My next step would be to lock the row.

    I have posted HERE

    I confident I can achieve a before save event to lock the last used row but what would be great if there was a way to lock the row with the password of the person who last used it. I trying to create a form of accountability and make it secure as possible.

    Any help would be appreciated

  2. #2
    Forum Contributor
    Join Date
    09-05-2008
    Location
    UK
    Posts
    103

    Re: Couple of Userform, Change event queries

    I sure I have to put something in this code. If username and password is correct insert username to active cell. Username is textbox1

    Public pattempts
    Private Sub cmbValidate_Click()
    
    If Trim(TextBox1.Text) = "" Then
        MsgBox "Please enter your login", vbCritical, "Login error"
        Exit Sub
    End If
    If Trim(TextBox2.Text) = "" Then
        MsgBox "Please enter your password", vbCritical, "Password error"
        Exit Sub
    End If
    
    Set login = Sheets("User Database").UsedRange.Resize(, 1).Find(TextBox1.Text, , xlValues, xlWhole)
    If login Is Nothing Then
        pattempts = pattempts + 1
        If pattempts = 3 Then Call close_wkb
        TextBox3.Text = TextBox3.Text + 1
        MsgBox "You have tried " & pattempts & " time and " & IIf(pattempts = 1, 2, 1) & " attempts left", vbInformation, "Validation error"
        Exit Sub
    End If
    
    Set Password = login.Offset(, 1)
    If Password <> TextBox2.Text Then
        pattempts = pattempts + 1
        If pattempts = 3 Then Call close_wkb
        TextBox3.Text = TextBox3.Text + 1
        MsgBox "You have tried " & pattempts & " time and " & IIf(pattempts = 1, 2, 1) & " is balance", vbInformation, "Validation error"
        Exit Sub
    End If
    
    Login_Form.Hide
    
    End Sub

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Couple of Userform, Change event queries

    Hi welshman010,

    May I have any 1 of the username or passwords created in your file attached so I can take some opportunity to test my codes before giving you my suggestion?
    Username & passwords set in file PC.xlsm

    Thanks for your understanding.
    Best Regards,
    CSLim

  4. #4
    Forum Contributor
    Join Date
    09-05-2008
    Location
    UK
    Posts
    103

    Re: Couple of Userform, Change event queries

    username aaa pass 1234

    Thanks for looking

  5. #5
    Forum Contributor
    Join Date
    09-05-2008
    Location
    UK
    Posts
    103

    Re: Couple of Userform, Change event queries

    Quote Originally Posted by CSLim View Post
    Hi welshman010,

    May I have any 1 of the username or passwords created in your file attached so I can take some opportunity to test my codes before giving you my suggestion?
    Username & passwords set in file PC.xlsm

    Thanks for your understanding.
    I have tweaked it some more adding validationlist to ROW W see attached. PC2.xlsm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] UserForm Change of data value event- Label show or hide
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2014, 11:54 AM
  2. [SOLVED] UserForm ComboBox Change Event Question
    By tja1964 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2012, 07:21 PM
  3. Userform Multipage Event Change
    By sepandb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2008, 01:40 PM
  4. A couple of queries
    By Feline in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 02-09-2007, 10:49 AM
  5. Couple of vlookup queries
    By T De Villiers in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2006, 03:35 PM

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