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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field exist? Then change control source

Status
Not open for further replies.

hedidit

Technical User
Jul 21, 2005
142
GB
Hi,

I have a report that is based upon a crosstab report which lists data relating to three seperate years. Prior to the report loading the user selects the first of 3 years that the report is to be based upon, e.g. they select 2006 and see data relating to 2006, 2005 and 2004.

The problem i have is that obviously my database might not have data relating to, for example, 2004. The report sets the control sources of three detail fields using:

Code:
Me.Date2.ControlSource = Forms![REPORTS:CompCriteria]![Text24] - 1

**where Text24 holds a four digit date entered by the user (e.g. 2006)


I was wondering whether there was any way to:

a) Find out whether the field Forms![REPORTS:CompCriteria]![Text24]-1 actually exists in the query?

b) Set the control source to the value of [text24]-1 if the field exists or "unbound" if it doesn't? I tried an IIf statement for this but it didn't work!

Any help greatfully received!

Cheers
 
Sorry just noticed a typo... the report is based upon a crosstab query not a crosstab report!
 
This may help:
Changing Month Crosstab issue
thread703-1270476

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top