Hi all,
Appreciate any help with my query.
I am developing an access dtb to record Accidents, Incidents and Near Misses. I have a table named SHE_Database. This has ID as the primary key and a field called Record_Type and another field called Reference.
What I am trying to do is potentially use the DMax function to increment a unique reference number for each record by not using the ID field.
So if the very first record - ID 1 - is recorded as an ACCIDENT in the 'Record_Type' field, then I want the 'Reference' field to show as ACC-0001, and then sequentially after that for each record recorded as ACCIDENT, so the second ACCIDENT record recorded will show ACC-0002 and so on.
If the second record - ID 2 - is recorded as an INCIDENTin the 'Record_Type' field , I want the 'Reference' field to show as INC-0001, and then sequentially after that for each record recorded as INCIDENT, so the second INCIDENT recorded will show as INC-0002 and so on.
The same for NEAR MISS.
Is this possible with the DMAX function, or is there another way of doing this?
Any help would be greatly appreciated.
Thanks.
Barry.
Appreciate any help with my query.
I am developing an access dtb to record Accidents, Incidents and Near Misses. I have a table named SHE_Database. This has ID as the primary key and a field called Record_Type and another field called Reference.
What I am trying to do is potentially use the DMax function to increment a unique reference number for each record by not using the ID field.
So if the very first record - ID 1 - is recorded as an ACCIDENT in the 'Record_Type' field, then I want the 'Reference' field to show as ACC-0001, and then sequentially after that for each record recorded as ACCIDENT, so the second ACCIDENT record recorded will show ACC-0002 and so on.
If the second record - ID 2 - is recorded as an INCIDENTin the 'Record_Type' field , I want the 'Reference' field to show as INC-0001, and then sequentially after that for each record recorded as INCIDENT, so the second INCIDENT recorded will show as INC-0002 and so on.
The same for NEAR MISS.
Is this possible with the DMAX function, or is there another way of doing this?
Any help would be greatly appreciated.
Thanks.
Barry.