Results 1 to 4 of 4

Thread: ADO Data Control Connection to Access97

  1. #1

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Post

    I am trying to connect my VB app to an Access 97 db, A:\Elements.dat.

    My code is this:

    Code:
    Dim strTemp
    strTemp = App.Path
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source = " & strTemp & "Elements.dat"
    Adodc1.RecordSource = "Elements"
    Adodc1.CursorType = adOpenStatic
    When I try to connect, I get no errors, but no connection, either...

    My app & my DB are in the same directory. The DB is named with an extension of .DAT to keep users from snooping. I've tested the name thing with another app & it worked fine...

    I'm stumped. Any ideas?

    Thanks!!

    My work E-mail has been tempermental lately, so please feel free to use [email protected] Thanks!!

    Also, the only reason I'm trying to connect this way, rather than at design time is that I am unsure where the user will install and want to be flexible...If you know how to code it for a design-time connection, and allow user to install wherever they want, please let me know.


    [This message has been edited by rockies1 (edited 07-21-1999).]

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    Try using:

    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source = " & strTemp & "\Elements.dat"

    You are missing a backslash in your path.

    HTH,

    Preeti

  3. #3

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Post

    I got so frustrated over what I would consider a simple problem, I changed over to a standard data control. When it still didn't work I used your suggestion and it worked!!

    One thing I found...If it is installed at the root of a drive, it didn't need the \ but if it wasn't at the root, it did.

    I went around it like this:

    Code:
        If Right(App.Path, 1) = "\" Then
            Data1.DatabaseName = App.Path & "Elements.dat"
        Else
            Data1.DatabaseName = App.Path & "\Elements.dat"
        End If
    Thanks for the help!!

    PS: What is the difference between Member and Junior Member here?

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    I have no idea and I am trying to figure out when I became a member

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