Give record a number afetr aplying a filter....

  • Thread starter Thread starter gizmowiebe
  • Start date Start date
G

gizmowiebe

Guest
Hi there

I'm working on a order database. So far so good. Were I work we got different projects. And all these projects have there own orders. I made a form were u can select witch project orders u want to see. When selected a filter is being aplyed on a sub form. I can now see witch orders have been made for that project. But I would like to give those orders a number. Starting with 1 than 2 etc. When I use autonumber the orders get there number in order of data. This means that order 1 is voor project xxx. and order two can be for project aaa. Does anyone know a method to count the orders per project.

I hope I made myself clear

Thx

Gizmo :eek:
 
A possible solution is ...

Private Sub txtProjectID_AfterUpdate()
Me.txtOrderNo = 1 + DCount("*", "tblOrder", "[ProjectId]=" & Me.txtProjectID)
End Sub

This assumes that the order number and project ID are stored in a table called "tblOrder". Create a form based on the table, with two text boxes - txtOrderNo and txtProjectID. When you enter a project number, the order number will be calculated.

hth

shay :cool:
 

Users who are viewing this thread

Back
Top Bottom