• Access data problems (little bit long)

    From scbs29@21:1/5 to All on Tue May 9 15:55:17 2017
    I have a table CDNames in an Access 2003 database containing records
    for a program to pick up.
    There were 72 records in the table.
    I added a new record :
    i_CDName CDName CDPath ExecPath
    169 ppw path to data folder path to
    program executable IsActive
    -1

    The query set up in the program is
    SELECT CDPath From CDNames WHERE CDName = "ppw"

    Run query in Access and it works fine
    Run query in VB and it can't find CDName = "ppw"

    The code to set the query and get CDPath is exactly the same as I have
    used in other programs and it works every time except this one.
    GetPath "ppw"

    Sub GetPath(strCDName As String)
    CONN_STR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    GetDBPath & "\craftprogs\craftprogs.mdb"
    strSQL = "SELECT CDPath From CDNames WHERE CDName = " & """" &
    strCDName & """"
    Set clsXa = New clsDB
    clsXa.SetSQL strSQL - set SQL in class instance
    clsXa.SetConnection (CONN_STR) - set connection
    clsXa.Connect - connect to database
    clsXa.Fetch
    Public Sub Fetch()
    Set objComm = New ADODB.Command
    ' set connection for command
    objComm.ActiveConnection = objConn
    objComm.CommandText = strSQL
    objComm.CommandType = adCmdText
    Set Recset = objComm.Execute()
    End Sub

    If clsXa.Recset.EOF Then
    MsgBox ("Error" & vbCrLf & "Path " & strCDName & " not found"
    & vbCrLf & "Program ending")
    End
    End If

    strPath = clsXa.Recset.Fields("CDPath").Value & "\"
    clsXa.Disconnect
    End Sub

    I then did a bit more investigating and added a further record, making
    2 new ones.
    I found that the query was not reading in all of the records, missing
    out the new ones.
    I then changed the query to
    strSQL = "SELECT * From CDNames"
    and it made no difference, still missed the 2 new ones.
    I then changed some of the names in the CDName field and ran the
    program again, printing the records to a text file.
    The text file showed that the CDNames fields were exactly the same as
    before I changed them.
    The changes had not been picked up, and the records I obtained
    appeared to be from the earlier database.
    The only copy of the database on my system is that with the changes
    made.
    Accessing the database from programs I had previously compiled
    displays the values that I expect, but running from within the IDE
    gives the old values before I changed them.
    Could my VB6 installation be corrupted in some way ? If so, would
    reinstalling over the top of the existing one help ?
    Can anyone advise, I am completely at a loss.

    --
    remove fred before emailing

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From scbs29@21:1/5 to All on Tue May 9 15:56:30 2017
    Apologies, greeting mmissed out.
    Should have started
    Hello all

    On Tue, 09 May 2017 15:55:17 +0100, scbs29 <scbs29@fred.talktalk.net>
    wrote:

    I have a table CDNames in an Access 2003 database containing records
    for a program to pick up.
    There were 72 records in the table.
    I added a new record :
    i_CDName CDName CDPath ExecPath
    169 ppw path to data folder path to
    program executable IsActive
    -1

    The query set up in the program is
    SELECT CDPath From CDNames WHERE CDName = "ppw"

    Run query in Access and it works fine
    Run query in VB and it can't find CDName = "ppw"

    The code to set the query and get CDPath is exactly the same as I have
    used in other programs and it works every time except this one.
    GetPath "ppw"

    Sub GetPath(strCDName As String)
    CONN_STR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    GetDBPath & "\craftprogs\craftprogs.mdb"
    strSQL = "SELECT CDPath From CDNames WHERE CDName = " & """" &
    strCDName & """"
    Set clsXa = New clsDB
    clsXa.SetSQL strSQL - set SQL in class instance
    clsXa.SetConnection (CONN_STR) - set connection
    clsXa.Connect - connect to database
    clsXa.Fetch
    Public Sub Fetch()
    Set objComm = New ADODB.Command
    ' set connection for command
    objComm.ActiveConnection = objConn
    objComm.CommandText = strSQL
    objComm.CommandType = adCmdText
    Set Recset = objComm.Execute()
    End Sub

    If clsXa.Recset.EOF Then
    MsgBox ("Error" & vbCrLf & "Path " & strCDName & " not found"
    & vbCrLf & "Program ending")
    End
    End If

    strPath = clsXa.Recset.Fields("CDPath").Value & "\"
    clsXa.Disconnect
    End Sub

    I then did a bit more investigating and added a further record, making
    2 new ones.
    I found that the query was not reading in all of the records, missing
    out the new ones.
    I then changed the query to
    strSQL = "SELECT * From CDNames"
    and it made no difference, still missed the 2 new ones.
    I then changed some of the names in the CDName field and ran the
    program again, printing the records to a text file.
    The text file showed that the CDNames fields were exactly the same as
    before I changed them.
    The changes had not been picked up, and the records I obtained
    appeared to be from the earlier database.
    The only copy of the database on my system is that with the changes
    made.
    Accessing the database from programs I had previously compiled
    displays the values that I expect, but running from within the IDE
    gives the old values before I changed them.
    Could my VB6 installation be corrupted in some way ? If so, would >reinstalling over the top of the existing one help ?
    Can anyone advise, I am completely at a loss.

    --
    remove fred before emailing

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)