Linking an option group in a form to a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has a option frame, one of which is the current year
project and the other one is the total project. This form is linked up to a
report which displays the hours of a certain project. I am just wokdering how
to link the option so that when i choose the current year, the week ending
shows the dates for the starting and ending week of the year. And when i
choose the total projects, it shows total hours for the projects even if the
project was completed over a couple of years.
 
Tanhus,

You can do this in the Criteria of the query that the report is based
on. I am not sure of the precise meaning of your requirements, but the
general concept would be the SQL of the query would include something
like this...
WHERE ((Year([YourDateField])=Year(Date()) And
[Forms]![YourForm]![YourOptionGroup]=1) Or
[Forms]![YourForm]![YourOptionGroup]=2)
 
As soon as i put this statement in the report gives me errors that it cannot
read the other fields in the report. The fields are already located in the
record source of the report, however some how they get disabled when i go
back into the design view. I do not understand what is happenign

Steve Schapel said:
Tanhus,

You can do this in the Criteria of the query that the report is based
on. I am not sure of the precise meaning of your requirements, but the
general concept would be the SQL of the query would include something
like this...
WHERE ((Year([YourDateField])=Year(Date()) And
[Forms]![YourForm]![YourOptionGroup]=1) Or
[Forms]![YourForm]![YourOptionGroup]=2)

--
Steve Schapel, Microsoft Access MVP
I have a form that has a option frame, one of which is the current year
project and the other one is the total project. This form is linked up to a
report which displays the hours of a certain project. I am just wokdering how
to link the option so that when i choose the current year, the week ending
shows the dates for the starting and ending week of the year. And when i
choose the total projects, it shows total hours for the projects even if the
project was completed over a couple of years.
 
Tanhas,

Can you please post back with the SQL view of the query that is the
report's record source?

If you try to run the query itself, does the query datasheet return the
expected data?
 
I actually got it to work, I just didnt need to put in the WHERE part.
Thanks for your help
 
Back
Top