BillieBurgess
Technical User
I created a form that loops through records pasting the information onto the vendor’s website and then moves onto the next record.
The problem is that sometimes due to a slow connection either on our side or the vendors, the code debugs due to the page not pulling up in time. I wrote an on Error line for the code to skip to the next record and continue. However, the debug still comes up. It doesn't follow the on error message at all. I can't figure out why and was hoping someone might help.
Here is the code:
The problem is that sometimes due to a slow connection either on our side or the vendors, the code debugs due to the page not pulling up in time. I wrote an on Error line for the code to skip to the next record and continue. However, the debug still comes up. It doesn't follow the on error message at all. I can't figure out why and was hoping someone might help.
Here is the code:
Code:
Private Sub NoteAllRecordsEWeb_Click()
On Error GoTo Err_NoteAllRecordsEWeb_Click
If IsNull(User) Then
MsgBox "Please enter your Initials"
GoTo Exit_NoteAllRecordsEWeb_Click
End If
Dim obIE As SHDocVw.InternetExplorer
Dim strText As String
Dim vURL As String
Dim stMsg As String
Dim strCSGACCTNUMBER As String
Dim strWORKORDERNUMBER As String
Me.RecordsetClone.MoveFirst
If Me.RecordsetClone.RecordCount > 0 Then
AddEWebNotes:
Do Until Me.RecordsetClone.EOF
Me.Bookmark = Me.RecordsetClone.Bookmark
If IsNull([CSGACCTNUMBER]) Then
MsgBox "CSG Account Number is not Entered", vbOKOnly
Me.RecordsetClone.MoveNext
End If
strText = Me!Note.Value
strCSGACCTNUMBER = [CSGACCTNUMBER]
vURL = "https:websiteURL.cfm?ACCTNO=" & strCSGACCTNUMBER
'Create the IE Object
Set obIE = CreateObject("InternetExplorer.Application")
While obIE.Busy = True
DoEvents
Wend
obIE.navigate vURL
While obIE.Busy = True
DoEvents
Wend
obIE.FullScreen = False
obIE.Visible = True
While obIE.Busy = True
DoEvents
Wend
With obIE.Document
.all.Item("accountMemo").Value = strText
.Forms("memoForm").submit
While obIE.Busy = True
DoEvents
Wend
End With
EWEB = Environ("UserName")
[E-CONNECTDATE] = Date
obIE.Quit
Me.RecordsetClone.MoveNext
Loop
End If
Me.RecordsetClone.Close
Exit_NoteAllRecordsEWeb_Click:
'Closes and Reopens Form to See any Records that were skipped
DoCmd.Close acForm, "frmEWeb", acSaveNo
DoCmd.OpenForm "frmEWeb", acNormal, , , acFormEdit, acWindowNormal
Exit Sub
Err_NoteAllRecordsEWeb_Click:
'Skip and move to the next record if there is an error
Me.EWEB = Null
Me.RecordsetClone.MoveNext
GoTo AddEWebNotes
End Sub