Connecting Tech Pros Worldwide Forums | Help | Site Map

runtime error 91

Newbie
 
Join Date: Apr 2007
Posts: 2
#1: Apr 8 '07
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.recordset.recordcount // ERROR IN THIS LINE
formula for random no
text1.text = random no
text2.text = adodc1.recordset.fields("message")
end sub

PLEASE REPLY FAST........
SRRY FOR THE TROUBLE
THNX IN ADVANCE
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#2: Apr 8 '07

re: runtime error 91


Where did you get this?


[PHP]adodc1.recordset[/PHP]

It is an object and it doesn't look that it is declared or collected anywhere.
Newbie
 
Join Date: Apr 2007
Posts: 2
#3: Apr 8 '07

re: runtime error 91


i get it in adodc1.recordset.recordcount

does adodc1 need to be initialize........... please help
iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#4: Apr 8 '07

re: runtime error 91


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
.ConnectionString = "Provider=Microsoft.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]
Reply


Similar Visual Basic 4 / 5 / 6 bytes