I assume your data looks like this --
RowNum Scanned Data
1 INV123
AG67891
AG67895
EG12344
EG12345
2 INV456
AG67891
AG67895
AG97895
EG12344
EG12345
having a Chr(13) & Chr(10) between invoice and products.
Create a table like this --
ROWNUM INVOICE PRODUCT
Long integer Text Text
Build these three queries --
ChoonBoy_1
INSERT INTO INV_PROD ( ROWNUM, INVOICE, PRODUCT )
SELECT Tbl_Input.RowNum, Left([Scanned Data],6) AS Expr1, Mid([Scanned
Data],InStr([Scanned Data],"EG"),7) AS Expr2
FROM Tbl_Input;
ChoonBoy_2
INSERT INTO INV_PROD ( ROWNUM, INVOICE, PRODUCT )
SELECT Tbl_Input.RowNum, Left([Scanned Data],6) AS Expr1, Mid([Scanned
Data],InStr([Scanned Data],"AG"),7) AS Expr2
FROM Tbl_Input;
ChoonBoy_3
UPDATE INV_PROD, Tbl_Input SET Tbl_Input.[Scanned Data] =
Replace(Replace([Scanned Data],[PRODUCT] & Chr(13) & Chr(10),""),[PRODUCT] &
Chr(13) & Chr(10),"")
WHERE (((Left([Scanned Data],6))=[INVOICE]));
Create a macro and Set Warning - No. Add these thre queries using action
OpenQuery as many times as you will have products on an invoice. And finish
macro with Set Warning - Yes.
The first two queries will append invoice and product to the Inv_Prod table,
one product at a time. Third query will remove the product and the carriage
return & line feed. When it is done there will be one product left with the
incoice number as the record will not have a carriage return & line feed on
the end of the data.
--
Build a little, test a little.
ChoonBoy said:
I do not have multiple invoices in the same record but I have an Invoice with
multiple products.
- First we scan the Invoice barcode which is captured in the text field.
- After this we scan the invoiced products barcode
- When the first Invoice + products are scanned, we continue with the other
invoices and products.
All the data are captured in one column, starting with Invoice code and
followed by product code in the next row.
1) My Table (Tbl_Input) only have 2 fields "RowNum" (Auto number) and
"Scanned Data" (text)
2) I use a datasheet Form (disabled sorting) with datasource pointing to the
Tbl_Input.
3) Any row of codes below the Invoice code are products associated to the
invoice until the next invoice number is encountered.
4) I need to build a report which must show "Invoice Code" as group header
and its products in the detail section.
5) I am not able to build the report with the only one column of mix codes.
I must somehow create another column so that it will show product's code in
one column and Invoice code in the next.
6) I do not know how to do No5 and will appreciate any help here.
Thank in advance.
:
Do you have multiple invoices in the same record?
If that is true then you need a two step process. First to put each invoice
in separate records with the product information.
Post your table and field names and sample data - maybe two records.
--
Build a little, test a little.
:
Actually it is hard to put in words but is something like this.
I am using a simple table with an auto number field (incremental) and a text
field.
1) A scanner is used to scan invoice nos to the text field (all invoices
starts with INVxxx
2) After the invoice nos is scanned, it is followed by scanning the products
into the same field but the next row (all products codes starts with either
EGxxxxx or AGxxxxx)
3) So you will have something like this for the column InvNos
/Prd1/Prd2/Prd3 etc. Next InvNos /Prd1/Prd2/Prd3/Prd4 etc, and the list goes
on.
4) I want to create a report to show each InvNos (group header) with Prds in
Detail section)
5) I am not able to do the report if I cannot associate the respective
InvNos to the Prds on the next column.
6) Using expression in the query (Scanned Data: IIf([barcode] Like
"inv*",[barcode],""), I am only able to move the InvNos to the next column.
7) The cell next to the prds is blank (which should be the respective InvNos.)
I hope I manage to give you a better picture.
Thanks
:
Are you sure you satated the row numbers correctly?
You have 13 rows for INVnos1 and 16 for INVnos2.
--
Build a little, test a little.
:
I am wondering if this is possible and appreciate any guide here.
I have a column (Scanned data) with incomplete values. Eg Row1 value =
"INVnos1" and Row2 until Row13 = Null. Row14 value = "INVnos2" and Row15
until Row30 = Null and so on.
How do I use codes / macro to fill Row2 until Row13 with value "INVnos1" and
Row15 until Row30 with value "INVnos2".
Thanks in advance.