> 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