Odd TransferText problem

davesmith202

Employee of Access World
Local time
Today, 19:21
Joined
Jul 20, 2001
Messages
522
I have the following code to import some data:

Code:
Dim a As String
Dim strDataToImport As String
Dim strOpenFileName As String
Me.txtCount2 = ""
strOpenFileName = OpenFileName

strDataToImport = strOpenFileName
DoCmd.TransferText , "Import Spec TransferText Test", "tblStage1Import", strDataToImport

Sample data:

[Event "Excelsior Cup"]
[Site "Goteburg"]
[Date "1998.01.14"]
[Round "1"]
[White "Aagaard, J."]
[Black "Brynell, S."]
[Result "1/2"]
[WhiteELO "2435"]
[BlackELO "2465"]
[EventDate "1998.??.??"]
[ECO "D07"]
[PlyCount "27"]

1.d4 d5 2.c4 dxc4 3.Nf3 Nf6 4.Nc3 Nc6 5.e4 Bg4 6.d5 Ne5 7.Bf4 Ng6 8.Bg3 e5 9.dxe6
Qxd1+ 10.Rxd1 Bxe6 11.Ng5 Bb4 12.f4 h6 13.Nxe6 fxe6 14.Bxc4 1/2

[Event "FSIM Juni"]
[Site "Budapest"]
[Date "1995.05.??"]
[Round "1"]
[White "Aagaard, J"]
[Black "Gardner, R"]
[Result "1-0"]
[WhiteELO "2245"]
[BlackELO "2185"]
[EventDate "1995.??.??"]
[ECO "D31"]
[PlyCount "53"]

1.d4 d5 2.c4 e6 3.Nc3 c6 4.e3 Bd6 5.Nf3 Ne7 6.Bd3 Nd7 7.O-O f5 8.Rb1 O-O 9.b4 Nf6
10.Qb3 Qe8 11.b5 Ne4 12.Ba3 Bc7 13.Rfc1 Rf6 14.bxc6 bxc6 15.cxd5 Nxc3 16.Qxc3 exd5
17.Ne5 Bxe5 18.dxe5 Rh6 19.f4 Bd7 20.Rb7 Nc8 21.Qa5 Nb6 22.Rxa7 Rxa7 23.Qxa7 Nc4
24.Bxc4 dxc4 25.Rd1 Be6 26.Qc7 Bd5 27.Rb1 1-0

The problem I have is that if there is a period after the name (e.g. [White "Aagaard, J."] in first bit of data), then it gets stored as [White "Aagaard, J, with a bit missing off the end after the period.

If you at the second bit of data, where there is [White "Aagaard, J"], then this imports fine, without truncating the record.

I am using a fixed width spec of 150 characters.

Any idea why this is happening and how to get around it?

Thanks,

Dave
 
I fixed this by changing this line:

Code:
DoCmd.TransferText , "Import Spec TransferText Test", "tblStage1PGNImport", strDataToImport

to...

Code:
DoCmd.TransferText acImportFixed, "Import Spec TransferText Test", "tblStage1PGNImport", strDataToImport

...and it now works! :)
 

Users who are viewing this thread

Back
Top Bottom