R
RB Smissaert
In Excel VBA and ADO I am running SQL on 2 text files to join them on a
common field to make a third text file.
Connection is with the Jet.OLEDB driver and the connection string is setup
like this:
TempTextConn = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\TempTables\;" & _
"Extended Properties=Text;"
The 2 text files are joined on a common field called PATIENT_ID and this
field holds only integer numbers.
This is the layout of the 2 text files:
File PATIENT.txt:
PATIENT_ID
8
9
16
etc.
File ENTRY.txt:
ENTRY_ID,PATIENT_ID,START_DATE,READ_CODE
2152,3,19890420,2464.
2332,7,19920309,246..
2403,7,19900319,2464.
3073,8,19970210,2464.
3074,8,19970210,246..
3076,8,19970210,246A.
3134,8,19911227,2465.
etc.
There is a schema.ini file with this:
[ENTRY2.txt]
ColNameHeader = True
CharacterSet = 1252
Format = CSVDelimited
Col1=ENTRY_ID Integer
Col2=PATIENT_ID Integer
Col3=START_DATE Integer
Col4=READ_CODE Text
And this is the SQL:
SELECT
P.PATIENT_ID,
E.ENTRY_ID,
E.START_DATE,
E.READ_CODE
INTO ENTRY2.txt IN
'C:\TempTables\'
'Text;FMT=Delimited'
FROM
PATIENT.txt P INNER JOIN ENTRY.txt E ON
(P.PATIENT_ID = E.PATIENT_ID)
WHERE NOT E.READ_CODE IS NULL
And this is how it is run:
Set rs = New ADODB.Recordset
rs.Open Source:=strQuery, _
ActiveConnection:=TempTextConn, _
CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly, _
Options:=adCmdText
All this has been used for years and without any problem.
Now however there is one user where the rows of the file ENTRY.txt
with the READ_CODE 246.. are not passed on to the file ENTRY2.txt
even although there should be a join on PATIENT_ID.
Now I could maybe understand this if this was on different computers, but
the
problem even shows when I run this SQL on the same (my) computer.
So the files ENTRY.txt and PATIENT.txt produced on the computer of this
user, but
run on my computer have the problem, whereas files ENTRY.txt and PATIENT.txt
produced
on my computer run fine and the rows with READ_CODE 246.. are passed on
nicely.
I have examined the files very carefully, but I just can't see any
difference and there shouldn't be
as they are produced by the same software with the same SQL.
Any insight or advice in this very greatly appreciated.
RBS
common field to make a third text file.
Connection is with the Jet.OLEDB driver and the connection string is setup
like this:
TempTextConn = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\TempTables\;" & _
"Extended Properties=Text;"
The 2 text files are joined on a common field called PATIENT_ID and this
field holds only integer numbers.
This is the layout of the 2 text files:
File PATIENT.txt:
PATIENT_ID
8
9
16
etc.
File ENTRY.txt:
ENTRY_ID,PATIENT_ID,START_DATE,READ_CODE
2152,3,19890420,2464.
2332,7,19920309,246..
2403,7,19900319,2464.
3073,8,19970210,2464.
3074,8,19970210,246..
3076,8,19970210,246A.
3134,8,19911227,2465.
etc.
There is a schema.ini file with this:
[ENTRY2.txt]
ColNameHeader = True
CharacterSet = 1252
Format = CSVDelimited
Col1=ENTRY_ID Integer
Col2=PATIENT_ID Integer
Col3=START_DATE Integer
Col4=READ_CODE Text
And this is the SQL:
SELECT
P.PATIENT_ID,
E.ENTRY_ID,
E.START_DATE,
E.READ_CODE
INTO ENTRY2.txt IN
'C:\TempTables\'
'Text;FMT=Delimited'
FROM
PATIENT.txt P INNER JOIN ENTRY.txt E ON
(P.PATIENT_ID = E.PATIENT_ID)
WHERE NOT E.READ_CODE IS NULL
And this is how it is run:
Set rs = New ADODB.Recordset
rs.Open Source:=strQuery, _
ActiveConnection:=TempTextConn, _
CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly, _
Options:=adCmdText
All this has been used for years and without any problem.
Now however there is one user where the rows of the file ENTRY.txt
with the READ_CODE 246.. are not passed on to the file ENTRY2.txt
even although there should be a join on PATIENT_ID.
Now I could maybe understand this if this was on different computers, but
the
problem even shows when I run this SQL on the same (my) computer.
So the files ENTRY.txt and PATIENT.txt produced on the computer of this
user, but
run on my computer have the problem, whereas files ENTRY.txt and PATIENT.txt
produced
on my computer run fine and the rows with READ_CODE 246.. are passed on
nicely.
I have examined the files very carefully, but I just can't see any
difference and there shouldn't be
as they are produced by the same software with the same SQL.
Any insight or advice in this very greatly appreciated.
RBS