Microsoft access- Sequential Numbering
So I am trying to put together a form in Microsoft Access that will autopopulate a demobilization number immediately before saving the record. I am no expert in Access and am not sure where to physically put my coding.
Here is the coding I am using... the fields are tailored to what I have in my working copy.
Me.demobgenerator = Nz(DMax("[Demob Number]", "Master Database"), 0) + 1
DoCmd.RunCommand acCmdSaveRecord
So where should I put this coding / is it correct for what I want? See below for more details...
The form based on my query will pick up records that have the status set to demobbing and transfers the selected fields from the datasheet to the appropriate boxes on the form. I would like the demobilization number txt box to automatically recognize the incident number (field in the datasheet) and the apply the next available number (starting at 1 to say 00000) for that demobilization at that incident. (I would also like to have '-D-' separating the info.)
(Example : Incident-D-001, or TIM001-D-001 but then for another incidient TIM002-D-001, TIM002-D-002, TIM002-D-003... etc.)