Open IE from Access

From http://www.databasejournal.com/features/msaccess/article.php/10895_3505836_2Public

Public Function UpdateOrderInfoWebSite() As Long
On Error Resume NextDim objDoc As SHDocVw.InternetExplorer
Dim sURL As String
Dim lOrderID As Long
lOrderID = Forms!frmOrder!txtOrderID

Const cURL As String ="http://localhost/Orders/Process.asp"
sURL = cURL & "?ID=" & lOrderID
sURL = sURL & "&SDate =" & Forms!frmOrder!txtStatusDate
sURL = sURL & "&SID =" & Forms!frmOrder!cboStatusID
sURL = sURL & "&PONum =" & Forms!frmOrder!txtPONumber
sURL = sURL & "&CID =" & Forms!frmOrder!cboCustomerID

Set objDoc = New SHDocVw.InternetExplorer objDoc.Navigate sURL, , , True

' Need something to pause execution while URL is hit.
Dim i As Integer, j As Integer
For i = 0 To 1000
 j = DCount("*", "MsysObjects")
Next

UpdateOrderInfoWebSite = Err.Number

End Function

Notice that objDoc was declared as type SHDocVw.InternetExplorer? This declaration will fail to compile unless you set a reference to the Microsoft Internet Controls. Open any module and select References from the Tools menu. Scroll down the list until you find the Internet Controls reference and select it.

Notice that objDoc was declared as type SHDocVw.InternetExplorer? This declaration will fail to compile unless you set a reference to the Microsoft Internet Controls. Open any module and select References from the Tools menu. Scroll down the list until you find the Internet Controls reference and select it.

  • Share/Bookmark

Leave a Comment