1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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