[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Embedded Web Browser login script problem

Posted on 2006-03-21
5
Medium Priority
?
301 Views
Last Modified: 2012-05-05
I have an embedded web browser in a form and it is designed to automatically fill in the username and password and submit. When I step through the code it works great but when I try to run it from either a form load or a click it fails saying incorrect login infortmation. This has me stumped. I have put in delay loops, etc to no avail.

Any ideas?
0
Comment
Question by:edrz01
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:IT-Schubertz
ID: 16248409
Hi,

just post your code
0
 

Author Comment

by:edrz01
ID: 16248489
Option Compare Database

Private Sub Command18_Click()
Me.WebBrowser7.Navigate "http://someserver.com/HPOV_Reports/OVIS_USERNAMEGOESHERE/All/Data.gif"

End Sub

Function Logon()
        SysCmd SYSCMD_SETSTATUS, "Opening Internet Explorer"
        On Error Resume Next
        Set Ie = CreateObject("InternetExplorer.Application")
        If Err.Number <> 0 Then
            MsgBox "Unable to open Internet Explorer" & Chr(13) _
                & "Open it and navigate to Freeclaims.com manually."
            DoCmd.Hourglass False
            SysCmd SYSCMD_CLEARSTATUS
            Exit Function
        End If
        WebBrowser1.Visible = True
        SysCmd SYSCMD_SETSTATUS, "Loading login page"
        With WebBrowser1
            .Navigate "http://someserver.com/hpov_reports/iops.htm"
            .Visible = True
        End With
        For pauseit = 1 To 100
        Next pauseit
        StartTime = Now()
           If DateDiff("s", StartTime, Now) > 120 Then
                WebBrowser1.Visible = False
                MsgBox "Unable to navigate to 'http://someserver.com/hpov_reports/iops.htm" _
                    & Chr(13) & "The site may not be active at this time" _
                    & Chr(13) & "Try to navigate there manually."
                WebBrowser1.Visible = True
                WebBrowser1.Value = Nothing
                'Set WebBrowser1 = Nothing
                DoCmd.Hourglass False
                SysCmd SYSCMD_CLEARSTATUS
                Exit Function
            End If
           Err.Clear
           WebBrowser1.Document.login.focus
       
        WebBrowser1.Document.login("customer").Value = "USERNAMEGOESHERE"
        WebBrowser1.Document.login("Pswd").Value = "^P@ssW0rd!"

WebBrowser1.Document.login.Action = "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?content=login&"
        WebBrowser1.Document.login.focus
        WebBrowser1.Document.login("customer").Value = "USERNAMEGOESHERE"
        Password = "^P@ssW0rd!"
        WebBrowser1.Document.login("Pswd").Value = Password
        For pauseit = 1 To 100
        Next pauseit
        WebBrowser1.Document.Forms("LOGIN").submit.focus
        'Ie.Document.LOGIN.submit
 '       MsgBox (Err.Number)
        For pauseit = 1 To 100
        Next pauseit

        If Err.Number = 424 Then
            Err.Clear
        ElseIf Err.Number <> 0 Then
            WebBrowser1.Visible = False
            WebBrowser1.Visible = True
           
            DoCmd.Hourglass False
            SysCmd SYSCMD_CLEARSTATUS
            Exit Function
        End If
        For pauseit = 1 To 100
        Next pauseit

Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=availability&customer=USERNAMEGOESHERE&startTime=-1&probeType=All+Services&endTime=-1"
End Function

Private Sub Frame0_Click()
Me.WebBrowser1.Visible = True
Logon
Select Case Me.Frame0.Value
Case 1
Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=availability&customer=USERNAMEGOESHERE&startTime=-1&probeType=All+Services&endTime=-1"
Case 2
Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=response&customer=USERNAMEGOESHERE&startTime=-1&probeType=All+Services&endTime=-1"
Case 3
Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=violations&customer=USERNAMEGOESHERE&startTime=-1&probeType=All+Services&endTime=-1"
Case 4
Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=trend&customer=USERNAMEGOESHERE&metric=AVAILABILITY&probeType=All+Services&serviceGroup=All+Service+Groups"
Case 5
Me.WebBrowser1.Navigate "http://someserver.com/HPOV_IOPS/cgi-bin/RepIOps.exe?utf8=1&content=snapshot&customer=USERNAMEGOESHERE&metric=AVAILABILITY&probeType=All+Services&serviceGroup=All+Service+Groups"
End Select
End Sub
0
 
LVL 7

Accepted Solution

by:
IT-Schubertz earned 500 total points
ID: 16248901
Hi,

any reason why you try to set the user information twice?
try adding Doevents before you set the values and after that:

       DoEvents()
       WebBrowser1.Document.login.focus
       WebBrowser1.Document.login("customer").Value = "USERNAMEGOESHERE"
       WebBrowser1.Document.login("Pswd").Value = "^P@ssW0rd!"
       DoEvents()
       ....
       .Submit


HTH Andy
0
 

Author Comment

by:edrz01
ID: 16249066
Andy, looks like a syntax problem with the DoEvents(). It errors saying it is expecting an '='.
0
 
LVL 7

Expert Comment

by:IT-Schubertz
ID: 16249151
Sorry,
just type DoEvents     and then <ENTER>


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question