Run-Time Error 91

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • opie
    New Member
    • Nov 2007
    • 15

    #1

    Run-Time Error 91

    Thank you in advance for your help.

    When I run the following I get a "Run-Time Error 91: Object variable or With block variable not set"



    Code:
     Function GetAddress() As Hyperlink 
     
    Dim dbLogBook As DAO.Database
    Dim tblStation As DAO.Recordset
    Dim strSQL As String
    Dim hypAddress As Hyperlink
     
    Set dbLogBook = CurrentDb
     
    strSQL = "SELECT A1 FROM tblStation"
     
    Set tblStation = dbLogBook.OpenRecordset(strSQL)
     
    hypAddress = tblStation("A1")
     
    tblStation.Close
     
    GetAddress = hypAddress
     
    End Function


    It is having a hang up on this line "hypAddress = tblStation("A1" )"

    If I set "hypAddress " of course I get a "Type Mismatch"

    What am I doing wrong?
    Last edited by Jim Doherty; Nov 8 '07, 01:23 AM. Reason: Code tags
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The Hyperlink object represents a hyperlink associated with a control on a form, report, or data access page. What is it you're trying to do?

    Comment

    • opie
      New Member
      • Nov 2007
      • 15

      #3
      I was able to fix it I wasn't using a variant

      Thanks for your help

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Good luck.

        Comment

        • ql25
          New Member
          • Jun 2010
          • 3

          #5
          re: Run-Time Error 91

          Nice Replays!

          Comment

          Working...