With Block error 91 Please help 
Author Message
 With Block error 91 Please help

Hi

I'm really starting to get PISSED at this error

Error 91: Object variable of With Block variable not set.

It occurs after re-executing this part:

    frmRelationProperties.tblRelations.Recordset.MoveLast
    frmRelationProperties.tblRelations.Recordset.MoveFirst

tblRelations is and ordinairy DataControl (data1 eg.)
The first time is works perfectly but when i leave the form and want to view
the properties/details of a other relation this error occurs. The sub where
this code is in is located in the same form (frmRelationProperties)

I absolutly don't know why this error occurs (I understand what it means but
don't understand why it occurs because I don't use with/end with here and as
far as I know I don't need to set the database with SET myDB= blabla because
I use a DataContole

I looked everywhere for more information on this topic but can't find no
documentation at al

I'm desperate

Sander



Sun, 17 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
Have you tried refreshing the recordset or running the query that creates
the recordset when you return to the form?

Joe

<snips>

Quote:

>It occurs after re-executing this part:

>    frmRelationProperties.tblRelations.Recordset.MoveLast
>    frmRelationProperties.tblRelations.Recordset.MoveFirst

>tblRelations is and ordinairy DataControl (data1 eg.)
>The first time is works perfectly but when i leave the form and want to
view
>the properties/details of a other relation this error occurs. The sub where
>this code is in is located in the same form (frmRelationProperties)



Sun, 17 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
Hi

frmRelationProperties.tblRelations.Refresh does affect the error. I tried
that.
I'm not running any queries. I just added a datacontrole and added the
databasename and the tablename to it. Nothing special.

As you see. I don't get it..

Thanks

Sander



Quote:
> Have you tried refreshing the recordset or running the query that creates
> the recordset when you return to the form?

> Joe

> <snips>

> >It occurs after re-executing this part:

> >    frmRelationProperties.tblRelations.Recordset.MoveLast
> >    frmRelationProperties.tblRelations.Recordset.MoveFirst

> >tblRelations is and ordinairy DataControl (data1 eg.)
> >The first time is works perfectly but when i leave the form and want to
> view
> >the properties/details of a other relation this error occurs. The sub
where
> >this code is in is located in the same form (frmRelationProperties)



Sun, 17 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
sorry, Refreshing the tblRelations does NOT affect the error, it stays...


Sun, 17 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
Just got done troubleshooting error 91 in vb6 here.  We were opening a
database and catching errors with  On Error code.  Within the On unit we
issued another opendatabase and were getting error 91.  The fix was to
change the On unit to do a Resume to an open statement which was outside of
the On Error block.  Interestingly, the old code worked ok  in vb3 and vb4
32 bit.

John


Quote:
> Hi

> I'm really starting to get PISSED at this error

> Error 91: Object variable of With Block variable not set.

> It occurs after re-executing this part:

>     frmRelationProperties.tblRelations.Recordset.MoveLast
>     frmRelationProperties.tblRelations.Recordset.MoveFirst

> tblRelations is and ordinairy DataControl (data1 eg.)
> The first time is works perfectly but when i leave the form and want to
view
> the properties/details of a other relation this error occurs. The sub
where
> this code is in is located in the same form (frmRelationProperties)

> I absolutly don't know why this error occurs (I understand what it means
but
> don't understand why it occurs because I don't use with/end with here and
as
> far as I know I don't need to set the database with SET myDB= blabla
because
> I use a DataContole

> I looked everywhere for more information on this topic but can't find no
> documentation at al

> I'm desperate

> Sander



Sun, 17 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
I believe you have tried to access the Data Control's properties before the
visual component is fully initialized.  The solution is to put the offending
code in the form_Activate event as opposed, for example in the form_load
event.  The form_load event is where the form's visual components are drawn,
and if you put code in this event, it is possible the code will be executed
before the component is available.  The form_Activate event occurs after the
form_load event, so you don't have the problem.


Quote:
> Hi

> I'm really starting to get PISSED at this error

> Error 91: Object variable of With Block variable not set.

> It occurs after re-executing this part:

>     frmRelationProperties.tblRelations.Recordset.MoveLast
>     frmRelationProperties.tblRelations.Recordset.MoveFirst

> tblRelations is and ordinairy DataControl (data1 eg.)
> The first time is works perfectly but when i leave the form and want to
view
> the properties/details of a other relation this error occurs. The sub
where
> this code is in is located in the same form (frmRelationProperties)

> I absolutly don't know why this error occurs (I understand what it means
but
> don't understand why it occurs because I don't use with/end with here and
as
> far as I know I don't need to set the database with SET myDB= blabla
because
> I use a DataContole

> I looked everywhere for more information on this topic but can't find no
> documentation at al

> I'm desperate

> Sander



Mon, 18 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
Oke, i'm going to try that but still i find it strange that the first time i
open the form it works but after reloading it, it failes.
Here's an other hint that might help solving this

I start my project with a sub main()
In that main all the datacontrole are initialized (setting dbasename and
table, however dbasename should be enough because the rest is static)
After that a tree and a listview is loaded with some table contents. When I
dblclick on an item in the listview a load the form by

    frmRelationProperties.Show vbModal, Me (which contains two
datacontroles)

After the user's done there he/she could leave the form by the X, the Oke or
the Cancel button. Cancel and Oke are triggering the Unload (Me) event. I'n
not sure what the X does (Terminate or Unload)

Well after recalling the form ( ....Show) the error occurs ??

I simply don't know why

Thanks in advance for all suggestions.
Sander



Quote:
> I believe you have tried to access the Data Control's properties before
the
> visual component is fully initialized.  The solution is to put the
offending
> code in the form_Activate event as opposed, for example in the form_load
> event.  The form_load event is where the form's visual components are
drawn,
> and if you put code in this event, it is possible the code will be
executed
> before the component is available.  The form_Activate event occurs after
the
> form_load event, so you don't have the problem.



> > Hi

> > I'm really starting to get PISSED at this error

> > Error 91: Object variable of With Block variable not set.

> > It occurs after re-executing this part:

> >     frmRelationProperties.tblRelations.Recordset.MoveLast
> >     frmRelationProperties.tblRelations.Recordset.MoveFirst

> > tblRelations is and ordinairy DataControl (data1 eg.)
> > The first time is works perfectly but when i leave the form and want to
> view
> > the properties/details of a other relation this error occurs. The sub
> where
> > this code is in is located in the same form (frmRelationProperties)

> > I absolutly don't know why this error occurs (I understand what it means
> but
> > don't understand why it occurs because I don't use with/end with here
and
> as
> > far as I know I don't need to set the database with SET myDB= blabla
> because
> > I use a DataContole

> > I looked everywhere for more information on this topic but can't find no
> > documentation at al

> > I'm desperate

> > Sander



Mon, 18 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
I can not find the reference, but I recall reading in "Beginning Visual
Basic 6 Database Programming" from Wrox that it is not good procedure to
initialize your database in the submain of a module (I have done it many
times myself). I think the reason might be that the processing may for some
reason move on to other things before the database is finished initializing.
I am sorry to be vague on this, but I can not recall or find the details.

I think it would possibly be better to create a separate initialization sub
in the module for the purposes of setting up the database and to call this
sub from submain.  Again, I am not sure of this.


Quote:
> Oke, i'm going to try that but still i find it strange that the first time
i
> open the form it works but after reloading it, it failes.
> Here's an other hint that might help solving this

> I start my project with a sub main()
> In that main all the datacontrole are initialized (setting dbasename and
> table, however dbasename should be enough because the rest is static)
> After that a tree and a listview is loaded with some table contents. When
I
> dblclick on an item in the listview a load the form by

>     frmRelationProperties.Show vbModal, Me (which contains two
> datacontroles)

> After the user's done there he/she could leave the form by the X, the Oke
or
> the Cancel button. Cancel and Oke are triggering the Unload (Me) event.
I'n
> not sure what the X does (Terminate or Unload)

> Well after recalling the form ( ....Show) the error occurs ??

> I simply don't know why

> Thanks in advance for all suggestions.
> Sander



> > I believe you have tried to access the Data Control's properties before
> the
> > visual component is fully initialized.  The solution is to put the
> offending
> > code in the form_Activate event as opposed, for example in the form_load
> > event.  The form_load event is where the form's visual components are
> drawn,
> > and if you put code in this event, it is possible the code will be
> executed
> > before the component is available.  The form_Activate event occurs after
> the
> > form_load event, so you don't have the problem.



> > > Hi

> > > I'm really starting to get PISSED at this error

> > > Error 91: Object variable of With Block variable not set.

> > > It occurs after re-executing this part:

> > >     frmRelationProperties.tblRelations.Recordset.MoveLast
> > >     frmRelationProperties.tblRelations.Recordset.MoveFirst

> > > tblRelations is and ordinairy DataControl (data1 eg.)
> > > The first time is works perfectly but when i leave the form and want
to
> > view
> > > the properties/details of a other relation this error occurs. The sub
> > where
> > > this code is in is located in the same form (frmRelationProperties)

> > > I absolutly don't know why this error occurs (I understand what it
means
> > but
> > > don't understand why it occurs because I don't use with/end with here
> and
> > as
> > > far as I know I don't need to set the database with SET myDB= blabla
> > because
> > > I use a DataContole

> > > I looked everywhere for more information on this topic but can't find
no
> > > documentation at al

> > > I'm desperate

> > > Sander



Mon, 18 Mar 2002 03:00:00 GMT  
 With Block error 91 Please help
Hi William

Actually an other procdure is called from the main() that initializes the
datacontroles but hey someone solved the problem:

"Instead of leaving the form with unload you should just hide the form with
Hide.Me" he said
Well that works fine. He told me that when a form is becomes unloaded all
settings are set to "Nothing".

Thanks for the reply

Sander



Quote:
> I can not find the reference, but I recall reading in "Beginning Visual
> Basic 6 Database Programming" from Wrox that it is not good procedure to
> initialize your database in the submain of a module (I have done it many
> times myself). I think the reason might be that the processing may for
some
> reason move on to other things before the database is finished
initializing.
> I am sorry to be vague on this, but I can not recall or find the details.

> I think it would possibly be better to create a separate initialization
sub
> in the module for the purposes of setting up the database and to call this
> sub from submain.  Again, I am not sure of this.



> > Oke, i'm going to try that but still i find it strange that the first
time
> i
> > open the form it works but after reloading it, it failes.
> > Here's an other hint that might help solving this

> > I start my project with a sub main()
> > In that main all the datacontrole are initialized (setting dbasename and
> > table, however dbasename should be enough because the rest is static)
> > After that a tree and a listview is loaded with some table contents.
When
> I
> > dblclick on an item in the listview a load the form by

> >     frmRelationProperties.Show vbModal, Me (which contains two
> > datacontroles)

> > After the user's done there he/she could leave the form by the X, the
Oke
> or
> > the Cancel button. Cancel and Oke are triggering the Unload (Me) event.
> I'n
> > not sure what the X does (Terminate or Unload)

> > Well after recalling the form ( ....Show) the error occurs ??

> > I simply don't know why

> > Thanks in advance for all suggestions.
> > Sander



> > > I believe you have tried to access the Data Control's properties
before
> > the
> > > visual component is fully initialized.  The solution is to put the
> > offending
> > > code in the form_Activate event as opposed, for example in the
form_load
> > > event.  The form_load event is where the form's visual components are
> > drawn,
> > > and if you put code in this event, it is possible the code will be
> > executed
> > > before the component is available.  The form_Activate event occurs
after
> > the
> > > form_load event, so you don't have the problem.



> > > > Hi

> > > > I'm really starting to get PISSED at this error

> > > > Error 91: Object variable of With Block variable not set.

> > > > It occurs after re-executing this part:

> > > >     frmRelationProperties.tblRelations.Recordset.MoveLast
> > > >     frmRelationProperties.tblRelations.Recordset.MoveFirst

> > > > tblRelations is and ordinairy DataControl (data1 eg.)
> > > > The first time is works perfectly but when i leave the form and want
> to
> > > view
> > > > the properties/details of a other relation this error occurs. The
sub
> > > where
> > > > this code is in is located in the same form (frmRelationProperties)

> > > > I absolutly don't know why this error occurs (I understand what it
> means
> > > but
> > > > don't understand why it occurs because I don't use with/end with
here
> > and
> > > as
> > > > far as I know I don't need to set the database with SET myDB= blabla
> > > because
> > > > I use a DataContole

> > > > I looked everywhere for more information on this topic but can't
find
> no
> > > > documentation at al

> > > > I'm desperate

> > > > Sander



Mon, 18 Mar 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Object variable or With block variable not set (Error 91) Please Help

2. HELP : Error 91 : Run-Time Error 91 Object Variable or With

3. Please help with VB4.0 Object Server error and error 91

4. error 91 with block variable not set

5. Object variable or With block variable not set (Error 91)

6. Error 91-Object or block with variable not set

7. error 91 Object Variable o on with block variable is not set

8. Error 91: Object Var or With block var not set

9. Runtime error 91/Object variable or With block variable not set problems

10. runtime error: 91 Object variable or with block variable not set

11. error 91 - object or block with variable not set

12. Run Time Error 91: Object variable or With Block variable not set

 

 
Powered by phpBB® Forum Software