Is This Impossible??? (1 Viewer)

DALIEN51

Registered User.
Local time
Today, 17:06
Joined
Feb 26, 2004
Messages
77
I have a table with 3 fields: CUSTOMER, START INVOICE NUMBER and END INVOICE NUMBER

I want to populate an identically formatted table with a consolidated list of start and end invoice number ranges for each customer. HOWEVER! Heres the rub....

The ranges for each customer in your starting table may overlap, one range of numbers may fit inside another range of numbers for the same customer.

For example:

Customer: X Start: 10 Finish: 15
Customer: X Start: 11 Finish: 17
Customer: X Start: 9 Finish: 16
Customer: X Start: 3 Finish: 7

I want to represent this in my new table as:

Customer: X Start: 3 Finish 7
Customer: X Start: 9 Finish: 17

I have been banging my head again against a wall for hours trying to work this out.........

PLEASE HELP!

Regards,

Dalien51
 

Studentos

Registered User.
Local time
Today, 19:06
Joined
Dec 23, 2005
Messages
38
Create a form, place a button on form and then double click it to create OnClick event.

Write following code (with your names):
Code:
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("YOUR_TABLE")

Dim i As Integer
i = 1
While Not rs.EOF
    rs.Edit
    rs.Fields("START INVOICE NUMBER") = i
    i = i + 10
    rs.Fields("END INVOICE NUMBER") = i
    i = i + 1
    rs.Update
    rs.MoveNext
Wend

This will create 10 invoices for each customer
 

Studentos

Registered User.
Local time
Today, 19:06
Joined
Dec 23, 2005
Messages
38
If you will have compile errors then in VBA editor go Tools -> References and mark "Microsoft DAO ..."
 

Users who are viewing this thread

Top Bottom