table based i one field splitted in 2 fields

E

Emanuel Violante

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
 
J

John W. Vinson

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?
 
E

Emanuel Violante

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
 
J

Jeff Boyce

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.
 
J

John W. Vinson

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
 
D

David W. Fenton

=?Utf-8?B?RW1hbnVlbCBWaW9sYW50ZQ==?=
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?
 
E

Emanuel Violante

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
 

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