mutiple products per order

J

Jae Hood

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
 

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

Similar Threads


Top