All
I have a form on which I placed a webbrowser control. On the "On current"-event procedure below runs, but it errors on link "oHTMLDoc.open" with Run-time error 91, object variable or With block variable not set
I did enable reference Microsoft HTML Object Library
Code:
Private Sub ToonFotos()Dim strSQL As String
Dim rs As Recordset
Dim strOutput As String
Dim oWebBrowser As Object
Dim oWebBrowserObject As Object
Dim oHTMLDoc As MSHTML.HTMLDocument
strSQL = "select [pad] from qryGerechtFoto" ' where [gerecht_fk]=" & Me.Teller
Set rs = CurrentDb.OpenRecordset(strSQL)
strOutput = "<html>"
If Not rs.BOF And Not rs.EOF Then
strOutput = strOutput & "<table><tr>"
While Not rs.BOF And Not rs.EOF
strOutput = strOutput & "<td>" & rs!pad & "</td>"
rs.MoveNext
Wend
End If
Set oWebBrowser = Me.WebBrowser
Set oWebBrowserObject = oWebBrowser.Object
Set oHTMLDoc = oWebBrowserObject.Document
oHTMLDoc.Open "text/html", "replace"
oHTMLDoc.Document.write = strOutput
oHTMLDoc.Close
End Sub
Someone an idea how to solve this?