Autonumber (Dmax)

fabrizio19

Registered User.
Local time
Yesterday, 16:20
Joined
Aug 9, 2012
Messages
75
Hi,
I have this problem:
Field autonumber named C.
The autonumber depends of 2 fields (A and B)
If A=1 and B=1 then C=1
every time I open the form it correctly gives to me the next number with Dmax function.
But
if A=1 and B=2 Dmax I would like that C=1 again (start again the sequential number)
or
if A=1 and B=3 Dmax I would like that C=1 again (start again the sequential number)
How can I do that?
I'm using dmax.Should I use also right function?
Please help me
this problem is driving me mad
yours
f
 
Hello f, could you state your problem again? with some real example and the data you would like to see..
 
Thank you for your help.
I have a 2 form named Cath lab and IABP respectively.
From the cath lab I have 2 field: N°of patient (PTS) and Ablation N (AN) that are automatically generated by the Dmax function.
Then from the cath lab I have another button that opens the form named IABP.
In the IABP from I have 3 field: named PTS (that it is the PTS of the cath lab) AN (that is the same of the cath lab) (by the openargs function) and the 3th field named "Number of IABP inserted" (NIABP) that automatically should be incremented of 1 by the Dmax function.Untill here every things works well.
The problem is that Every PTS can have several ablations (AN) and several insertions of IABP.
Thus if the the PTS is unchanged and the AN is changed (new ablation) the Number of IABP inserted should restart from 1.
For instance:
PTS 1; AN 1 then NIABP is 1 (Dmax function)
PTS 1;AN 1 NIABP is 2 (second insertion of IABP in the same patients during the lenght of hospital stay)
So on....
BUT if
PTS =1; AN=2 then NIABP should be again 1 not 3 like now I is (new isertion of IABP during a second procedure (AN=2)
I hope I was clear enough.
Yours
f
 
Hi,
I have this problem:
Field autonumber named C.
The autonumber depends of 2 fields (A and B)
If A=1 and B=1 then C=1
every time I open the form it correctly gives to me the next number with Dmax function.
But
if A=1 and B=2 Dmax I would like that C=1 again (start again the sequential number)
or
if A=1 and B=3 Dmax I would like that C=1 again (start again the sequential number)
How can I do that?
I'm using dmax.Should I use also right function?
Please help me
this problem is driving me mad
yours
f
So what values in A and B would cause C to be <>1
 
Do you want to add a criteria to the DMax() function so it picks the maximum value of NIABP for any given combination of PTS & AN?

Code:
Dmax(fieldNameOfNIABP, yourTableName, "PTS = " & fieldNameOfPTS & " AND AN = " & fieldNameofAN)

Where:
fieldNameOfNIABP - the name of your NIABP field
yourTableName - the name of your table
fieldNameOfPTS - the name of your PTS field
fieldNameofAN - the name of your AN field
 

Users who are viewing this thread

Back
Top Bottom