From: David W. Fenton on
=?Utf-8?B?RW1hbnVlbCBWaW9sYW50ZQ==?=
<EmanuelViolante(a)discussions.microsoft.com> wrote in
news:E29E3502-67DE-4BBE-A516-D59FEFE07347(a)microsoft.com:

> It is a linked text file, exported from a code bar reader.

Are you aware that most bar code readers can input data directly
into Access? In other words, is it possible that the text file is
unnecessary?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: Emanuel Violante on
Thanks to everyone,

John, it worked just great.
It helped me a lot,

Once more, thanks to everyone......

:)
--
Thanks,

Sorry if my english isn''t correct, but I''m from Potugal ;)

Emanuel Violante Galeano


"John W. Vinson" wrote:

> On Thu, 29 Apr 2010 10:15:01 -0700, Emanuel Violante
> <EmanuelViolante(a)discussions.microsoft.com> wrote:
>
> >Hi,
> >
> >It is a linked text file, exported from a code bar reader.
> >
> >the file is always with on row for EAN, qty, EAN, qty.....
> >
> >Do you have any idea on how to get the ean and qty in the same row, in 2
> >fields???
> >Thanks
>
> That's probably actually good: a text file does have an order, even though a
> table doesn't.
>
> It would probably be best to use VBA code to read the text file line by line
> adding each value to a Recordset as you go. I'm really tied up and can't offer
> you any tested code, but try this:
>
> Dim rsIn As DAO.Recordset
> Dim rsOut As DAO.Recordset
> Dim db As DAO.Database
> Set db = CurrentDb
> Set rsIn = db.OpenRecordset("linkedtextfile", dbOpenSnapshot)
> Set rsOut = db.OpenRecordset("LocalTable", dbOpenDynaset)
> Do Until rsIn.EOF
> rsOut.AddNew
> rsOut!EAN = rsIn!fieldname
> rsIn.MoveNext
> rsOut!Qty = rsIn!fieldname
> rsOut.Update ' write the record
> rsIn.MoveNext
> Loop
>
>
> --
>
> John W. Vinson [MVP]
> .
>