Using DataGrid, VB6.0 calls wrong DB

Discussion in 'Visual Basic ( VB )' started by Donarco, Aug 26, 2012.

  1. Donarco

    Donarco New Member

    Joined:
    Sep 12, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Writing Computer Programs
    Location:
    Morris Oklahoma
    Working with Windows 7 and VB 6.0. When I "flag" Module 2 (listed below) and watch it execute, everything is OK with the Connection String as: "C:\Rwo1\General Ledger.mdb". However, when the calling projram executes, it attempts to access a
    totally different DB ("C:\Actg\DONAR\General Ledger.mdb").

    Module 2:

    Code:
    "Option Explicit
      Public gConn As ADODB.Connection
     
      Public Function OpenConnection()
        Set gConn = New ADODB.Connection
        gConn.Open ConnectionString
      End Function
     
      Public Function DatabasePath() As String
          DatabasePath = App.Path & "\General Ledger.mdb"
      End Function
     
      Public Function ConnectionString() As String
        ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" _
        & DatabasePath & ";Persist Security Info=False"
      End Function"
     
    Why doesn't the program which follows (using an ADO DataGrid) access the DB called
    in the Module? I hope someone can help.

    donarco
     
    Last edited by a moderator: Aug 27, 2012

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice