Data Control not initialized?

Data Control not initialized?

Post by Christopher G. Desan » Thu, 28 Aug 1997 04:00:00



Try putting the code in the form's activate event.

Chris Desany

 
 
 

1. Problem initializing data control

Hi!

Ok, I'm having a little trouble initializing the databasename property
for my data control.

I'm programming in VB 4.0 professional edition, I'm using a simple MDI
application format, and I'm using an Access 97 database.

Here's my setup so far:

I have a MDI parent when a menu bar. When the user clicks 'New' it loads
an instance of the child  (code snippet)

    dim newone as frmChild

    load newone

Then it opens the MDI child form.

Ok, I need to specify the database name during runtime otherwise when i
compile it later, my program won't be able to find the database. So, I
have found out how to do that which is as follows:

data1.databasename = app.path & "\mydatabase.mdb"

Right now I have it set up so that in the initialize event for the CHILD
form it adds a new record to the database (data1.recordset.addnew). I
need to do it here otherwise I get other problems. So, I thought, I'll
put it right before the .addnew and everything will be fine. WRONG!

Ok, IF I hard code the databasename property into the data control and
run the program, it runs fine. HOORAY! :)  HOWEVER, when I try to set it
during run time I get the following error when it is trying to add a new
record:

Run time error '91'
Object Variable or With block variable not set.

I'm thinking that the data control isn't loaded yet which is why I can't
access its properties.... is that right? I'm just starting to program so
please be gentle. :)

Thanks for your help.

Nick

2. Memo > 255

3. Microsoft DataGrid Control, cannot initialize data binding

4. SQL+ Table-Informations

5. Oracle Will Not Initialize the Data Base during install

6. Getting data back to SQL

7. Help ! ADO data control and standard data control

8. Problem Creating Data Windows from Stored Procedure

9. Data controls or no data controls?

10. Create User Control as Data Source Using ADO Data Control

11. data control and remote data control

12. Data Control vs Remote Data Control (for Axx95 and VB4/32 Enterprise)