Results 1 to 4 of 4
  1. #1
    tamangspace is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    2

    Mocrosoft web browser control can not display the web page

    Dear all,
    At first, I am a new user in vba. Learning from web and other examples. I am using ms access 2007 in windows 7 32 bit and IE9 and IE10.
    Let's go to the subject. I created a form to display the web page with Microsoft web browser control. I used a textbox 'text0' for address bar and a command button 'command2' for on-click event procedure.

    I used the code:
    Code:
    Private Sub Command2_Click()Dim varAdd As String
    varAdd = "me.Text0"
    If Text0 > 0 Then
    Me.WebBrowser4.Navigate "varAdd"
    Else
    Me.WebBrowser4.Navigate "www.google.com.sa"
    End If
    End Sub
    ]


    With that code I couldn't open any web page if I type any web address on text0 field. The web page shows "Navigation to the webpage was canceled". But If 'text0' field is empty, it works fine.
    I reset Internet Explorer's setting to default but that was also not working.
    Any help is appreciated.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try

    varAdd = me.Text0

    similarly you don't want quotes around the variable later.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tamangspace is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    2
    Dear pbaldy
    Thanks for your quick response. But I already tried this varAdd = me.Text0 and displays msgbox "invalid use of null" and displays as varAdd = me.Text0 highlighted yellow when i click on debug. It shows varAdd = "" when mouseover there. I think I wrote the code in wrong way but I don't know where is the mistake. Did you try the code? So frustrated...

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Well, you get that error if you try to put a Null into a string variable. Declare it as Variant like its prefix suggests.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2013, 10:47 PM
  2. Web Browser Control
    By MFS in forum Programming
    Replies: 0
    Last Post: 02-28-2013, 11:08 AM
  3. Web Browser Control
    By imran688 in forum Programming
    Replies: 1
    Last Post: 11-29-2012, 03:52 PM
  4. Web Browser Control
    By ctgann in forum Forms
    Replies: 5
    Last Post: 03-18-2011, 08:17 PM
  5. Replies: 5
    Last Post: 10-19-2010, 08:02 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums