Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Web Browser Control using Stream of HTNL

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I'm trying to open a web browser control on an Access 2003 form with an HTML source I create in VBA. The HTML must access some values from a table, so they will need to be variables (I have highlighted them in yellow).

I have the following code.

Problems are:
1. I can't get the code to run from form load event, only from button click event?
2. It doesn't load the html properly, all I can sea is a black box?
3. The string becomes too long, so I have to delete some lines to make it smaller?
4. I don't know how to include the variables?

Code:
[COLOR=#204A87]Private Sub Form_Load()
Dim HTML As String

HTML = "<html>" & _
"<html>" & _
"<body>" & _
"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'" & vbCr & _
"      id='player1'" & vbCr & _
"      name='player1'" & vbCr & _
"      width='480'" & vbCr & _
"      height='270'>" & vbCr & _
"  <param name='movie' value='player.swf'>" & vbCr & _
"  <param name='allowscriptaccess' value='always'>" & vbCr & _
"  <param name='bgcolor' value='#000000'>" & vbCr & _
"  <param name='flashvars' value='file=../media/[highlight #FCE94F]video.mp4[/highlight]>'" & vbCr & _
"  <embed" & vbCr & _
"        id='player1'" & vbCr & _
"        name='player2'" & vbCr & _
"        src='player.swf'" & vbCr & _
"        width='480'" & vbCr & _
"        height='270'" & vbCr & _
"        allowscriptaccess='always'" & vbCr & _
"        bgcolor='#000000'" & vbCr & _
"        flashvars='file=../media/[highlight #FCE94F]video.mp4[/highlight]'" & vbCr & _
"      />" & vbCr & _
"</object>" & vbCr & _
"</body>" & vbCr & _
"</html>"


webBrowser1.Document.write strHTML

End Sub[/color]
 
yeah, that could be a problem.

For your variables,

Dim sWidth

sWidth=460



strHTML = "<html>" & _
"<html>" & _
"<body>" & _
"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'" & vbCr & _
" id='player1'" & vbCr & _
" name='player1'" & vbCr & _
" width='" & sWidth & "'" & vbCr & _ <<<<< LOOKEEE HERE
" height='270'>" & vbCr & _
" <param name='movie' value='player.swf'>" & vbCr & _
" <param name='allowscriptaccess' value='always'>" & vbCr & _
" <param name='bgcolor' value='#000000'>" & vbCr & _
" <param name='flashvars' value='file=../media/video.mp4>'" & vbCr & _
" <embed" & vbCr & _
" id='player1'" & vbCr & _
" name='player2'" & vbCr & _
" src='player.swf'" & vbCr & _
" width='480'" & vbCr & _
" height='270'" & vbCr & _
" allowscriptaccess='always'" & vbCr & _
" bgcolor='#000000'" & vbCr & _
" flashvars='file=../media/video.mp4'" & vbCr & _
" />" & vbCr & _
"</object>" & vbCr & _
"</body>" & vbCr & _
"</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top