Access 2003 Import Wizard delimiter question

G

Guest

What does Access recognize as the delimiter character for CR/LF ?
I am trying to import records from an odd electronic device which outputs
its data in a straight text 28 line per record format, with a carriage return
line feed at the end of each line designating a new field in the same record.
The Import Text Wizard has an Other Choice which I clicked, but how do you
express this? I remember from the old days it was Hex 0D0A, but how do you
tell Access this?
Or is there a better way to do this?

Thanks
Frank in Spokane
 
A

Albert D. Kallal

Hum, I think even if y you could put in the delimiter for the fields..what
would be the delimiter for each record? (how would ms-access determine
this?).

I think this is one case where I would write my own custom code.

The code would:

a) pop up the open/file dialog and let the user browse to the
appropriate file
b) do the import.

The basic import code would look like:

Dim intF As Integer
Dim rstData As DAO.Recordset
Dim strInFile As String
Dim i As Integer
Dim j As Integer
Dim strBuf As String

strInFile = "c:\data\idata.txt"

intF = FreeFile()

Set rstData = CurrentDb.OpenRecordset("tblImport")

Open strLg1 For Input As intF

Do While EOF(intF) = False

rstData.AddNew
For i = 1 To 28
Input #intF, strBuf
rstData(i) = strBuf
Next i
rstData.Update

Loop

Close (intF)
rstData.Close
Set rstData = Nothing

The above is air code, but gives you an idea here. You could also change the
for i = 1 to 28 to a customer bit of code for each field:

' field #1 FirstName
input #intF, stuBuf
rstData!FirstName = strBuf

' field #2 LastName
input #intF, stuBuf
rstData!LastName = strBuf

etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top