mutiple products per order

G

Guest

hi,
my order management database has an order table with unique order ids(12345-1)
and a customer can order more than one product per order, each new product
goes into an order details subform which is related by the unique order id.

Is there a way of automating the process of numbering the orders like
12345-1 then 12345-2 and 12345-3 and so on for each new product in that same
order?

Thank you!
 
A

Allen Browne

Use 2 fields in the subform's table:
OrderID foreign key to Order.OrderID
RecNum Number

In the BeforeUpdate event procedure of the form:
Dim strWhere As String
If Me.NewRecord And Not IsNull(Me.Parent!OrderID) Then
strWhere = "OrderID = " & Me.Parent!OrderID
Me.RecNum = Nz(DMax("RecNum", "OrderDetail, strWhere), 0) + 1
End If
 
J

Joseph Meehan

Jae said:
hi,
my order management database has an order table with unique order
ids(12345-1) and a customer can order more than one product per
order, each new product goes into an order details subform which is
related by the unique order id.

Is there a way of automating the process of numbering the orders like
12345-1 then 12345-2 and 12345-3 and so on for each new product in
that same order?

Thank you!

Maybe I just don't understand your system, but why do you have numbers
like that?

Hopefully the users of the database don't really care about unique order
numbers for each item on an order so there sound not be a need for the user
to ever see that sub order number. Each item should appear to them as the
same order number 12345. Internally Access needs to keep track, but you can
let it do that on its own.
 

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