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

QUERY data from different COLUMNs

Status
Not open for further replies.

ciel220

Programmer
Jan 12, 2001
35
CA
Hello,

I'm having troubles with selecting data on different columns. For instance,

PERSON Year 1 Year 2 Year 3
------ ------ ----- ------
A 110 112 115
B 90 92 95
C 100 102 105

Depends on what year the user selects (I'll be using a COMBO box for selection), my query would select different data and perform sum, UP TO AND INCLUDING THAT YEAR SELECTED.

That is, if user select year 2
The query would report,

PERSON Year 1 Year 2 Sum
------ ------ ------ -----
A 110 112 222
B 90 92 182
C 100 102 202

But if year 1 is selected, only PERSON, YEAR 1 and SUM would be reported.

Could anyone please give me a hand on this? I have no idea on how I could select data on different column. PLEASE HELP!


THANK YOU SO MUCH!!!!

ciel
 
Perhape an Immdeiate If statement for the Sum field. Something like:

=IIf(Combobox = 1,Year1,IIf(Combobox = 2,Year1 + Year2,Year1+Year2+Year3))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top