Create an Incident number from a date and time field?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Another question from me, as my last one was kindly resolved by Allen Browne
:)

We currently create 'Incident Numbers' manually by reversing the date and
adding the time to the end: -

So,
An Incident raised at 14:15 on 13/06/06 would be manually entered into a
'Form' as 060613/14:15 Mistakes often occur so I want to generate these
Incident Numbers using a query somehow. Any suggestions?

Thanks.
 
If you are using the system clock then the following should generate the
incident number for you.
Format(Now(),"yymmdd\/hh:nn")


You could just store the DateTime in a DateTime field and then use the above
whenever you needed to see the incident number. Or you could use the formula
to generate the value and put it into a text field.
 
BetaMike said:
Another question from me, as my last one was kindly resolved by Allen Browne
:)

We currently create 'Incident Numbers' manually by reversing the date and
adding the time to the end: -

So,
An Incident raised at 14:15 on 13/06/06 would be manually entered into a
'Form' as 060613/14:15 Mistakes often occur so I want to generate these
Incident Numbers using a query somehow. Any suggestions?


You can use the Format function to create that string if
that's really what you want:
Format(Date(), "yymmdd\/hh:nn")

BUT, if you have a date field in the table, then you do not
want to store this formatted version in the table. Just
format it whenever you need to display it on a form or
report. In this situation all you need is to use a text
box's Format property without calculating anything.
 
Perfect, thanks a lot :)

Marshall Barton said:
You can use the Format function to create that string if
that's really what you want:
Format(Date(), "yymmdd\/hh:nn")

BUT, if you have a date field in the table, then you do not
want to store this formatted version in the table. Just
format it whenever you need to display it on a form or
report. In this situation all you need is to use a text
box's Format property without calculating anything.
 
Back
Top