If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Run-time error '91': Object variable or With block variable not set

I'm making a sales & inventory system & i have this error... when I tried to add Listview codes(different) even though there are already different codes of adodc DataGrid View in other forms and modules...
the problem also was I combined the declarations in the Module. Is that possible to declare two modules, one for adodc, and one for listview...??
I have been reading several treads on this forum abut this error but i cannot solve it.

I get an error on this line in Sub LoadData() part::: rs.Open "Select * from PurchaseOrder", db, 3, 3

Re: Run-time error '91': Object variable or With block variable not set

I would not say that it is wrong to not test the state especially on the line after opening it. It should be open at that point or generate an error on the open statement.

The part that is causing the error is that RS has not been sit to instance of a recordset like I stated in post #2

Actually I would not use a global RS but a local one in the sub if the sub is just intended to update a recordset and of course I would close the recordset afterwards.

It is really a bit sloppy to use a global connection and global rs and then assign them as new in a sub that will be called more than once and very sloppy if you are not closing them.
VB will let you get away with this kind of stuff but it is never a good idea and leads to poor programming habits.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.