Access automatic date field

S

Simon

Hi there,

I am trying to create a basic database which has a form I have created to
record orders due.

I can create a text box on the form which calculates the number of days
overdue but is it possible to link this to a field in the table which
changes on a daily basis?

Thanks
 
J

Jack Cannon

Simon,

Use a query as the RecordSource for the form instead of the table.
Then create a field in the query that calculates the overdue days.

Jack Cannon
 
K

ken

You can compute the number of days between a date and the current date
by including the Date function in an expression, so if you have a
DateDue bound control on a form then the number of days overdue at any
time would be shown in an unbound text box control with a
ControlSource property of:

=IIf(DateDiff("d",[DateDue], Date()) > 0,DateDiff("d",[DateDue], Date
()),Null)

The IIf function returns the value only if its greater than zero,
otherwise it returns Null.

Or you could have an OrderDate bound control, and say you allow 14
days for orders to be filled, the expression would then be:

=IIf(DateDiff("d",[OrderDate], Date()) > 14,DateDiff("d",[OrderDate],
Date()),Null)

You can of course do similarly in a report or query. You don't need
to, nor should you, store the current date in a column in the table.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top