How To Print Calculated Dates on Report

ChrisCione

Registered User.
Local time
Today, 02:31
Joined
Sep 11, 2008
Messages
17
I have an unbound text box (called "Due Date") on my form which calculates a due date of a project based on two factors, both of which are fields in the db: the type (selected from a combo box) and the Date I was assigned the project. The field names are "Type" and "DateReceived".

The control source of the unbound text box is:

Code:
=Switch([Type]="Difficult",DateAdd("m",2,[DateReceived]),[Type]="Standard",[DateReceived]+10,[Type]="Complex",DateAdd("m",3,[DateReceived]))
A "standard" assignment is due in 10 days; "difficult", 2 months; "complex", 3 months.

It works beautifully.

How can I get this information to print on a report? I have multiple records (projects) assigned on different dates, so naturally each project has its own due date.

An early thanks for any assistance.
 
Is your form based on a query? If it isn't create a query and include all the fields from your table into the query, change your form's Record Source property to the query.

In the query, drop the code in a new column so it appears like this:
Code:
[COLOR=Red][B][I]Expr1:[/I][/B][/COLOR] Switch([Type]="Difficult",DateAdd("m",2,[DateReceived]),[Type]="Standard",[DateReceived]+10,[Type]="Complex",DateAdd("m",3,[DateReceived]))
Change Expr1 to something meaningful. Now this field is now part of the form's record source. Your report also should be based on this query so you can select the field from it too.

Or drop it in a textbox on your report just like you have it in your form.
 
Is your form based on a query? If it isn't create a query and include all the fields from your table into the query, change your form's Record Source property to the query.

In the query, drop the code in a new column so it appears like this:
Code:
[COLOR=Red][B][I]Expr1:[/I][/B][/COLOR] Switch([Type]="Difficult",DateAdd("m",2,[DateReceived]),[Type]="Standard",[DateReceived]+10,[Type]="Complex",DateAdd("m",3,[DateReceived]))
Change Expr1 to something meaningful. Now this field is now part of the form's record source. Your report also should be based on this query so you can select the field from it too.

Or drop it in a textbox on your report just like you have it in your form.

The report is already built on a query, so I tried your second suggestion, which worked like a charm.

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom