Open IE from Access

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

[sourcecode language=’vb’] Public Function UpdateOrderInfoWebSite() As Long
On Error Resume Next
Dim 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
[/sourcecode]

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 code module and select References from the Tools menu. Scroll down the list until you find the Internet Controls reference and select it.

Tags: No tags

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.