how do i combine date and time expressions

D

dutchbuster

I am trying to write a date time format expression, i.e. ddhhnnMmmyy into an
access programme so that I can have a text box which shows a traffic light
system for completing a task.

Example: Action within 2 hours stays green, 2 to 4 hours goes amber, over
four hours and the box goes red if no action is carried out in another text
box, which I assume you can link to the traffic light box.
 
A

Allen Browne

Presumably you have a date/time type field in your table?

If so, is is possible to create a weird format like the one you suggesed by
entering that string into the Format property of the text box on your form.
However, as soon as the focus moves into the text box, the format will
change to one that is suitable for data entry, so it will be very confusing
for the user. Instead, just define Short Date as you wish in the Windows
Control Panel (under Regional Settings), and then add the hours and minutes
to the end of the entry (not the middle).

To achieve the colour change, use Conditional Formatting:
1. Open your form in design view.
2. Select the text box that shoudl change color.
3. Choose Conditional Formatting on the Format menu.
4. Set it to an expression such as:
DateDiff("n", [MyField], Now()) > 120

Conditional Formatting is not available in Access 97 or earlier.
 
Top