Results 1 to 9 of 9

Thread: How do i set Data Control Properties

  1. #1

    Thread Starter
    Lively Member The_Game's Avatar
    Join Date
    Apr 2006
    Posts
    115

    How do i set Data Control Properties

    I am creating a test application to open a database and use a data control but keep getting the Run Time Error '91' - Object Variable or with Block variable not set

    Here is my code:

    VB Code:
    1. Option Explicit
    2. Private prvRsBatchHeader As Recordset
    3.  
    4. Private Sub Form_Load()
    5.  
    6.  [B]  Data1.DatabaseName = "C:\db1.mdb"[/B]
    7.    Data1.Recordset.Index = "PrimaryKey"
    8.    Set prvRsBatchHeader = Data1.Recordset
    9.    Data1.Recordset.AddNew
    10.        
    11. End Sub

    The line that is Bold is the line giving the error

    Can someone tell me how to set the properties of the Data Control so that it will work. Currently i just have the Data control (Data1) on my form

    Thanks a lot

  2. #2
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: How do i set Data Control Properties

    You can try this...

    Code:
    Private Sub Form_Load()
        'This code assumes that you added a reference to the Microsoft DAO 3.6 Object Library
        
        'Data1
            Set DBase1 = DBEngine.OpenDatabase("C:\db1.mdb")
            Set RecSet1 = DBase1.OpenRecordset("Table1")
            Set Data1.Recordset = RecSet1
    I hope this will help you !
    Last edited by DubweiserTM; Apr 18th, 2006 at 02:12 PM.
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  3. #3
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: How do i set Data Control Properties

    Is my suggestion resolve your problem ?
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  4. #4

    Thread Starter
    Lively Member The_Game's Avatar
    Join Date
    Apr 2006
    Posts
    115

    Re: How do i set Data Control Properties

    yes and no......
    It fixed my earlier problem, but led to this new problem......


    My biggest problem still is with the unrecognized database format error, but i'm trying to work past that and save that one for the end.

    Thanks for all your help yesterday

  5. #5
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: How do i set Data Control Properties

    Oh boy...

    Did you added a reference to the Microsoft DAO 3.6 Object Library ???

    If it's yes, you can try to update the Microsoft.Jet.OLEDB.4.0 provider. Go to link above:

    http://support.microsoft.com/default...b;en-us;303528
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  6. #6

    Thread Starter
    Lively Member The_Game's Avatar
    Join Date
    Apr 2006
    Posts
    115

    Re: How do i set Data Control Properties

    Quote Originally Posted by DubweiserTM
    Oh boy...

    Did you added a reference to the Microsoft DAO 3.6 Object Library ???

    If it's yes, you can try to update the Microsoft.Jet.OLEDB.4.0 provider. Go to link above:

    Ok, I;ve been struggling with this problem for over two weeks now. Here is what i have done so far. I have migrated an Access 97 Db to 2000 or 2002. I have opened blank databases and imported the files from there, i have gone in an converted the DB to each version. I do have the reference for the DAO 3.6 library and i have gone through that link before.

    I have the MsJet40.dll version 4.0.8618 ----> which relates to teh Jet 4.0 release level of "Windows XP SP2 and Security Belletin MS04-014" I download the XP upgrade they tell you too and when i run it, it gives me a message box saying i have a version of the service pack newer than the one about to be installed.

    I see a lot said about needing the Jet 4.0 service pack 8. Could this be the problem and if so, any ideas about how to go from version 8618 down to 8615


    Anything you can do to help would be fantastic, this problem is eating at me and i can't wait to get rid of it....... It feels like i've done everything the article tells you to do and still nothing seems to work to change the results.



    Say for a couple tweaks here and there i am done except for this unrecognized database error. I am at wits end and have already been pulling my hair out. I have downloaded Windows Service Pack 2 as well.

  7. #7
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: How do i set Data Control Properties

    Im very sorry, you did all I tried before...

    Sorry again...Please keep you hair on your head !!!
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  8. #8
    Junior Member
    Join Date
    Feb 2006
    Posts
    17

    Re: How do i set Data Control Properties

    the best way is to change the database file format to an earlier version using the utility provided in access.
    you may loose things specfic to acc 2000

  9. #9
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: How do i set Data Control Properties

    Use the ADODB objects (connection, command, recordset) instead of a data bound control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width