Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding an If/Then Title Field to a report 1

Status
Not open for further replies.

djmurphy58

Technical User
Feb 28, 2003
73
US
Ok here's the deal-
I have a form in which the user enters a start date, an end date, and a 6-digit cost code. From this data, the user hits a button that generates a report. The dates the user enters correlate to a construction phase for a jobsite. For example, Phase 17B occurred between 11/3/03 and 11/19/03. So if the user enters these dates for the start and end dates, I want a title to appear on my report that says "Phase 17B". Similarly, if the user enters different dates, for example a start of 6/1/03 and an end of 7/1/03, the title should be "Phase 7". How do I do this - is this some sort of If/Then statement???

Thank you,
Dennis
 
That will depend on your setup...an assumption based on already supplied info to us....you don't want an IF statement....you want a SELECT CASE because you have at least 17 steps and a different title for each stage. How do you check the dates? Take a look at thread702-716191 for a piece of code I supplied that is almost up your alley. Some changes and it should do what you need. Let us know how your tables are structure and we can help a lot more...

****************************
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
If this changes frequently you may want to set up a table in your database that has the following fiels: startdate, enddate, projectphase.

Then add a textbox to your report that would do a:

Dlookup(&quot;[projectphase]&quot;,&quot;tblProjectPhases&quot;,&quot;[Startdate]>=#&quot; & forms!formname!txtStartDate & &quot;# AND [enddate]<=#&quot; & forms!formname!txtEndDate & &quot;#&quot;)

That way if you need to add a phase or change the dates it will automatically retrieve that rather than having to change the select statement each time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top