Problem with referencing items ending in $0 in WebBrowser control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • topher23
    Recognized Expert New Member
    • Oct 2008
    • 234

    Problem with referencing items ending in $0 in WebBrowser control

    I'm trying to use a WebBrowser control to automate data entry from our local Access system to the web-based corporate ERP system. Unfortunately, I've run into a snag. Several of the text boxes that I need to populate have names that end in $0 and whenever my code hits one of these, Access goes "bonk!"

    Runtime Error 438, Object doesn't support this property or method.

    One of the offending code lines is:
    Code:
    Me.ieBrowser.Document.All.[SN_DATE$0].Value = rs!dtDate
    Where ieBrowser is the WebBrowser control, rs is the source recordset for the data being entered and dtDate is a valid Date field.

    So far, I've tried a couple of fixes that haven't worked. First, I tried the field name without wrapping it in brackets. Intellisense got all bent out of shape about that. Then I tried finding the Item # and referencing the field indirectly that way, but ran into even more trouble - the page is dynamic, so the Item numbers change depending on data entered.

    Any insight here would be most appreciated!
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Try this and see if it makes any difference ...

    Code:
    Me.ieBrowser.Document.All.Controls("SN_DATE$0").Value = rs!dtDate

    Comment

    • topher23
      Recognized Expert New Member
      • Oct 2008
      • 234

      #3
      Thanks, Mary! Although Document doesn't have a Controls collection, that made me think to use:
      Code:
      Me.ieBrowser.Document.All.Item("SN_DATE$0").Value = rs!dtDate
      which worked! You've saved me a lot of headache - I proposed this project, and if it had failed management would have been very unhappy.

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        No problem. I often find an indirect string refernce bypasses issues that arise with the use of names.

        Glad it put you on the right track.

        Mary

        Comment

        Working...