João serras-pereira
asked on
ms/access webbrowser address not valid -
On my app I am having the user selecting a file and wand to show him the file content (it will be a standard file - vídeo, PDF, Office, etc.) so I am opening a file dialogo, have the user select the file and then open a separate window that has 2 controls: a text, containing the full path so I may check out, and a web browser control, named wbr_documentView.
so, I am using the following code on the Load Form event:
strSourceFile = Nz(Forms![_commonVariables ]![pathDoc In], "")
Me.fld_sourceFile = strSourceFile
Me.wbr_documentView.Object .Navigate strSourceFile
but It almost always yield the error: The address is not valid
as below;
however, if I trap and wait a few seconds BEFORE the "Navigate", it runs smoothly.
So I think that I shoild wait for some event before navigating.
Can anyone help on how to do it?
so, I am using the following code on the Load Form event:
strSourceFile = Nz(Forms![_commonVariables
Me.fld_sourceFile = strSourceFile
Me.wbr_documentView.Object
but It almost always yield the error: The address is not valid
as below;
however, if I trap and wait a few seconds BEFORE the "Navigate", it runs smoothly.
So I think that I shoild wait for some event before navigating.
Can anyone help on how to do it?
In webbrowser control external viewer is loaded. May be you have full Acrobat or your file is too big and you need some time to load it? Try to load small local file and check result.
In your screenshot I see 4 slashes, when you need only 2
Try my sample
DBWebBrowser.accdb
In your screenshot I see 4 slashes, when you need only 2
Try my sample
DBWebBrowser.accdb
ASKER
Hi
well.. I have tried the db you have sent and it functions perfectly. as my other form in my own db for a different purpose.
However, on my db, for this "challenge" it does not work, yield always the same problem!...
my code, on load is:
Private Sub Form_Load()
Dim strSourceFile As String
Call logMe("Form_Load", "documentView")
Me.wbr_documentView.Object .Silent = True
Set viewBbr_documentView = wbr_documentView.Object
strSourceFile = Nz(Forms![_commonVariables ]![pathDoc In], "")
Me.fld_sourceFile = strSourceFile
'Me.wbr_documentView.Objec t.Navigate strSourceFile
'Me.wbr_documentView.Contr olSource = strSourceFile
viewBbr_documentView.Navig ate (strSourceFile)
End Sub
and I also tried using the .controlsource and ... same result!
any ideas?
well.. I have tried the db you have sent and it functions perfectly. as my other form in my own db for a different purpose.
However, on my db, for this "challenge" it does not work, yield always the same problem!...
my code, on load is:
Private Sub Form_Load()
Dim strSourceFile As String
Call logMe("Form_Load", "documentView")
Me.wbr_documentView.Object
Set viewBbr_documentView = wbr_documentView.Object
strSourceFile = Nz(Forms![_commonVariables
Me.fld_sourceFile = strSourceFile
'Me.wbr_documentView.Objec
'Me.wbr_documentView.Contr
viewBbr_documentView.Navig
End Sub
and I also tried using the .controlsource and ... same result!
any ideas?
Can you upload sample? (only necessary forms and tables without any sensitive data)
Try this code:
Private Sub Form_Load()
Dim StrSourceFile As String
StrSourceFile = "\\MAC\Home\Documents\p3.pdf"
Me.viewBbr_documentView.ControlSource = "='file:" & StrSourceFile & "'"
End Sub
ASKER
Hi -
I have tried the code that you have suggested at no avail...
I am sending in 2 additional messages:
1, the database (it's over 21 Mb and takes time to upload from here in Africa, and a set of guidelines that I am putting in on a word doc whilst the upload is running.
hope you can get me out of this frying pan...
/joao
I have tried the code that you have suggested at no avail...
I am sending in 2 additional messages:
1, the database (it's over 21 Mb and takes time to upload from here in Africa, and a set of guidelines that I am putting in on a word doc whilst the upload is running.
hope you can get me out of this frying pan...
/joao
ASKER
You should set controlsource for web browser like:
Copy/paste code. It is important to precede string with =" and finish with "
Single quotes could be used
Me.fld_sourceFile = "='file:" & strSourceFile & "'"
OrMe.fld_sourceFile = "=" & chr(34) & "file:" & strSourceFile & chr(34)
Copy/paste code. It is important to precede string with =" and finish with "
Single quotes could be used
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. I just got back to the office and I'll modify accordingly. On your last note: the [Me.fld_sourcefile] is not related to the web browser, it's just for me to check out..
ASKER
PERFECT!!!!!!!!! THANKS A LOT!
file:\\Mac\Home\Documents\