Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, have my suggestions helped?

    You need to:
    1. determine who the current user is - by having them provide ID or you grab from network with Environ("USERNAME")
    2. search the table to find credentials for that user for Neon Impact
    3. if no credentials then create new record
    4. continue login with the new credentials

    Code in my project - login form opens by default and Load event calls Sub UserLogin. If the user is already in table then the Menu form opens and Login closes, otherwise Login remains open for user input of initials and then a record is created and UserLogin is called again:
    Code:
    Private Sub Form_Load()
    UserLogin
    End Sub
    
    Private Sub UserLogin()
    Me.tbxUser = DLookup("UserInitials", "Users", "UserNetworkID='" & Environ("UserName") & "'")
    If Not IsNull(Me.tbxUser) Then
        CurrentDb.Execute "UPDATE Users SET ComputerName='" & VBA.Environ("ComputerName") & "' WHERE UserInitials='" & Me.tbxUser & "'"
        DoCmd.OpenForm "Menu", acNormal, , , , acWindowNormal, Me.tbxUser
        DoCmd.Close acForm, Me.Name, acSaveNo
    End If
    End Sub
    
    Private Sub tbxUser_AfterUpdate()
    If Me.tbxUser Like "[A-Z][A-Z][A-Z]" Or Me.tbxUser Like "[A-Z][A-Z]" Then
        CurrentDb.Execute "INSERT INTO Users(UserNetworkID, UserInitials, Permissions) VALUES('" & VBA.Environ("UserName") & "', '" & UCase(Me.tbxUser) & "', 'staff')"
        Call UserLogin
    Else
        MsgBox "Not an appropriate entry.", vbApplicationModal, "EntryError"
    End If
    End Sub

    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Fixed

    Alright, I have everything working now. What this does, when the button is clicked, it checks for the user and pass under the 'Neon Impact' tool, if nothing is there... it will give err.number 94. On error 94, It calls a routine to add the 'Neon Impact' to the table, then the user is prompted to enter their own credentials into this table. Then for future use, everything works as normal.

    Code:
    Sub ImpactNeon()
    
    
    Dim neon As InternetExplorer
    Dim Left, Right As InternetExplorer
    Dim User, Pass As String
    
    
    On Error GoTo Buildrow
    
    
    User = DLookup("[chrWebuser]", "tblWebCreds", "chrWebTools='Neon Impact'")
    Pass = DLookup("[chrWebpass]", "tblWebCreds", "chrWebTools='Neon Impact'")
    
    
    Set neon = Login("xxxxxxxxxxx", True)
    
    
    Call SleepIE(neon)
    
    
    neon.Document.frames(0).Document.all.Item("name").Value = User
    neon.Document.frames(0).Document.all.Item("password").Value = Pass
    
    
    PauseApp 2
    
    
    neon.Document.frames(0).Document.all.Item("button-Login").Click
    
    
    Buildrow:
    If Err.Number = 94 Then
       Call AddRow
        MsgBox "Please enter or adjust your credentials", vbCritical, "LIFT MESSAGE"
        DoCmd.OpenForm "frmWebCreds"
       Exit Sub
    End If
    
    
    End Sub
    Code:
    Sub AddRow()
    
    
       Dim Creds As DAO.Database
       Dim rstNeon As DAO.Recordset
    
    
       Set Creds = CurrentDb
       Set rstNeon = Creds.OpenRecordset("tblWebCreds")
    
    
       rstNeon.AddNew
       rstNeon("chrWebTools").Value = "Neon Impact"
       rstNeon("chrWebpass").Value = "void"
       rstNeon("chrWebuser").Value = "Not Set"
       rstNeon.Update
    
    
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Tab Issue
    By Lazor78 in forum Forms
    Replies: 3
    Last Post: 07-05-2012, 08:18 AM
  2. End if issue
    By raytackettsells in forum Programming
    Replies: 4
    Last Post: 03-22-2012, 10:21 AM
  3. VBA issue
    By manic in forum Programming
    Replies: 4
    Last Post: 02-28-2012, 03:57 PM
  4. IIF issue
    By mohiahmed in forum Queries
    Replies: 9
    Last Post: 01-22-2012, 01:06 AM
  5. Replies: 1
    Last Post: 10-31-2010, 12:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums