Reading a field and using that field to place a number in another field 
Author Message
 Reading a field and using that field to place a number in another field

Hi,
I have a table of invoice data. I want the program to read the invoice
number, determine if there is one or more than "one of the same invoice
numbers" and then place a 01, 02 , 03 etc in another field to designate
the duplicate lines. (I will call this field Line No.) If there is only
line of an invoice number then it would put only 01 in the Line Number
field. I have already created this program to produce an exported flat
file that will be read by a COBOL program. The dataset looks like this:

L01    83498888    00000001289930   767 3333
DPV744737333 00000001289930
L01    84599543    00000000076777   564 1456
L02    84599543    00000000444487   566 2000
DPV753533535 00000000521264

Right now I'm having the sender of the data put the 01,02, 03, 04 in
this field by hand. I would like to automate this process to avoid
errors.

Thanks for your help.

Linda



Fri, 11 Mar 2005 09:30:10 GMT  
 Reading a field and using that field to place a number in another field
Linda

Is there any specific "order" information (i.e., sorted by date, sorted by
keyID, ...)?

One approach would be (general concept only -- p-code):

    - Set a "counter" variable to 1
    - Set a temp variable to 0
    - Get a recordset of all rows, sorted by Invoice# (and any other
criteria - see above)
    - Start with the first record
Start loop
    - If the (row's) Invoice# matches the temp variable, add one to the
"counter"
    -   Else, Save the Invoice# in a temp variable and reset the counter to
1
    - Format the counter (?"01") and save it to the row
    - Move to next row in recordset
Loop

Actual syntax may vary

Good luck!

Jeff Boyce
<Access MVP>



Fri, 11 Mar 2005 21:15:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Breaking up a phone number field into seperate fields

2. Convert number field to text field.

3. Concatenating a Text Field and a Number Field

4. Need help reading Outlook keyword fields into Access field

5. Read HTML formatted data from database field, Insert Wordmerge fields, and save as Word document

6. When you create a field each field has a id number (field number) (how can you edit this number)

7. Copying Fields using Field.Value

8. Newbie Update field in DB using AutoNumber field

9. Moving field data between fields using VB 6 exe

10. Newbie Update field in DB using AutoNumber field

11. Using ENTER key to move from field to field

12. convert text field to numeric field being used in Selection Formula

 

 
Powered by phpBB® Forum Software