Help with a Police Database - Expression Building

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

I have created a database in Access 2000 that is used to
issue and track police warrants that are issued. Our
numbering style is "13-06300" the next one issued would
be "13-06301" and so on.

I want to make it so that after a record is entered the
next record would have the next number automatic entered
for that record.

Thanks...Your friendly neighborhood Policeman
 
The simplest way of doing this if the number always will start with "13-" is to
have your warrant number field only take the numerical value to the right of "-"
and then when you display it to concatenate the remaining part. In your example
your warrant numbers would be 6300 and 6301. You can get the next number by
setting the WarrantNum field default to the expression
DMax("[WarrantNum]","NameOfTable") + 1. This will automatically enter the
warrant number when you begin creating a new warrant record by entering
something in any of the other fields.

To get the complete warrant number, use the expression:

"13-" & Format([WarrantNum],"00000")

The five zeroes force five digits to the right of the dash so 6301 becomes 06301
and the entire number becomes 13-06301.

Thanks for all you "cops" do for us!

Steve
PC Datasheet
 
Back
Top