Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #2348
| From | scbs29 <scbs29@fred.talktalk.net> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: Access data problems (little bit long) |
| Message-ID | <04m3hcl801vlb7muffg436sedvdac1uhmi@4ax.com> (permalink) |
| References | <fjk3hc9ipebef3aqb041hn8hcvbjupqpq9@4ax.com> |
| Organization | Forte - www.forteinc.com |
| Date | 2017-05-09 15:56 +0100 |
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
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Find similar | Unroll thread
Access data problems (little bit long) scbs29 <scbs29@fred.talktalk.net> - 2017-05-09 15:55 +0100 Re: Access data problems (little bit long) scbs29 <scbs29@fred.talktalk.net> - 2017-05-09 15:56 +0100
csiph-web