From: Emanuel Violante on
Hi everyone,

I have a txt file with product EAN and label quantity to print.

3564700010822
2
3564700010983
5
3564700422687
10

I have a form to print label quantity.
What i pretend is "convert" the table in a 2 fields table or query like:

ProductCode |Quantity
3564700010822|2
3564700010983|5
3564700422687|10

Any help is apreciated.

--
Thanks,

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

Emanuel Violante Galeano
From: John W. Vinson on
On Thu, 29 Apr 2010 07:27:01 -0700, Emanuel Violante
<EmanuelViolante(a)discussions.microsoft.com> wrote:

>Hi everyone,
>
>I have a txt file with product EAN and label quantity to print.
>
>3564700010822
>2
>3564700010983
>5
>3564700422687
>10

Do you mean that your table has one field, and that the first record is an EAN
and the second record is a quantity? Is this an Access table, or is it being
imported from a text file or Excel spreadsheet?

If it's an Access table, you're in real trouble: tables *have no defined
order*, and there's nothing in the structure of the table that will let you
associate any particular EAN with its quantity. You might try to print the
labels for EAN 3564700010822 and get 3564700422687 copies! How was this table
created or filled?
--

John W. Vinson [MVP]
From: Emanuel Violante on
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


--
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 07:27:01 -0700, Emanuel Violante
> <EmanuelViolante(a)discussions.microsoft.com> wrote:
>
> >Hi everyone,
> >
> >I have a txt file with product EAN and label quantity to print.
> >
> >3564700010822
> >2
> >3564700010983
> >5
> >3564700422687
> >10
>
> Do you mean that your table has one field, and that the first record is an EAN
> and the second record is a quantity? Is this an Access table, or is it being
> imported from a text file or Excel spreadsheet?
>
> If it's an Access table, you're in real trouble: tables *have no defined
> order*, and there's nothing in the structure of the table that will let you
> associate any particular EAN with its quantity. You might try to print the
> labels for EAN 3564700010822 and get 3564700422687 copies! How was this table
> created or filled?
> --
>
> John W. Vinson [MVP]
> .
>
From: Jeff Boyce on
Emanuel

Your English is MUCH better than my Portugese!

If your text file has:

Record1Field1Value
Record1Field2Value
Record2Field1Value
Record2Field2Value
....

you could try importing that into Word, creating a table, then exporting the
table to Access.

How many records are in the text file?


Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Emanuel Violante" <EmanuelViolante(a)discussions.microsoft.com> wrote in
message news:E29E3502-67DE-4BBE-A516-D59FEFE07347(a)microsoft.com...
> 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
>
>
> --
> 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 07:27:01 -0700, Emanuel Violante
>> <EmanuelViolante(a)discussions.microsoft.com> wrote:
>>
>> >Hi everyone,
>> >
>> >I have a txt file with product EAN and label quantity to print.
>> >
>> >3564700010822
>> >2
>> >3564700010983
>> >5
>> >3564700422687
>> >10
>>
>> Do you mean that your table has one field, and that the first record is
>> an EAN
>> and the second record is a quantity? Is this an Access table, or is it
>> being
>> imported from a text file or Excel spreadsheet?
>>
>> If it's an Access table, you're in real trouble: tables *have no defined
>> order*, and there's nothing in the structure of the table that will let
>> you
>> associate any particular EAN with its quantity. You might try to print
>> the
>> labels for EAN 3564700010822 and get 3564700422687 copies! How was this
>> table
>> created or filled?
>> --
>>
>> John W. Vinson [MVP]
>> .
>>


From: John W. Vinson on
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]