DCount DMax

  • Thread starter Thread starter Bill Phillips
  • Start date Start date
B

Bill Phillips

I have an order table tblOrderDet into which I am
inserting records copied from a mainframe application.
The mainframe application does provide me with a Line#.
Line# will start at 1 for every quote and increment by 1.
Because I may have to use the same pasting procedure more
than once per order I need to be able to determine how
many records exist and what the maximum value (Max Line#)
is so I can increment the line# field. I'm sure I need to
use a domain funtion, but don't know how. Also I need to
be able to specify the current Order# as a criteria for
the domain function. If I can just get the domain
functions to work, I can code the line# and the
increment. Any help is greatly appreciated.
 
Thanks for the reply Ken, but I don't think it really
answers my problem. I still nee to constrain the Max Line#
record based on my current order only. (Lets say I have 10
orders of 10 lines each, in your scenario the max# will be
100. I need to know the max for a given order number.)I
don't see in the code where you are limiting the number to
the current order.

Thanks,
Bill
 
Bill,

Modify Ken's code:

NewNumber = Nz(DMax("Line#", "TableName","[OrderID] = " & Me!OrderID), 0) + 1
 
Thanks, PC.... I hadn't included a criterion expression because I wasn't
sure if one would be needed.

--
Ken Snell
<MS ACCESS MVP>

PC Datasheet said:
Bill,

Modify Ken's code:

NewNumber = Nz(DMax("Line#", "TableName","[OrderID] = " & Me!OrderID), 0) + 1

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com



Bill Phillips said:
Thanks for the reply Ken, but I don't think it really
answers my problem. I still nee to constrain the Max Line#
record based on my current order only. (Lets say I have 10
orders of 10 lines each, in your scenario the max# will be
100. I need to know the max for a given order number.)I
don't see in the code where you are limiting the number to
the current order.

Thanks,
Bill
 
Back
Top