runtime error 91

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moonraker1234
    New Member
    • Apr 2007
    • 2

    #1

    runtime error 91

    how can i solve "object or with block variable not set" ie runtime error 91 in vb
    my code is

    Dim max_range as integer
    Form_load()
    max_range = adodc1.recordse t.recordcount // ERROR IN THIS LINE
    formula for random no
    text1.text = random no
    text2.text = adodc1.recordse t.fields("messa ge")
    end sub

    PLEASE REPLY FAST........
    SRRY FOR THE TROUBLE
    THNX IN ADVANCE
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Where did you get this?


    [PHP]adodc1.recordse t[/PHP]

    It is an object and it doesn't look that it is declared or collected anywhere.

    Comment

    • moonraker1234
      New Member
      • Apr 2007
      • 2

      #3
      i get it in adodc1.recordse t.recordcount

      does adodc1 need to be initialize..... ...... please help

      Comment

      • iburyak
        Recognized Expert Top Contributor
        • Nov 2006
        • 1016

        #4
        It is hard for me to judge. I don't see your code.

        Did you connect your Adodc1 control to any data source?
        Did you do anything similar to this?

        [PHP]With Adodc1
        ' initialize our connection to the database
        .ConnectionStri ng = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & _
        App.Path & "\housedata.mdb ;Persist Security Info=False"
        ' set up the first query
        .RecordSource = BuildQuery()
        ' refresh the data source to make sure the query goes through. I'm still unclear
        ' as to how a bunch of this works...
        .Refresh
        End With[/PHP]

        Comment

        Working...