conditionals help please

R

Reno

Hey all

I need to find out how to get a database to a a series of numbers based on
whether a certain field has a 1 or a 2 in it

eg
textbox1's control source = sum [grade] if [semester] ="1"
else
textbox2's control source = sum [grade] if [semester] ="2"

i need this so that i get a total of grades for semester 1 in one box
and a total for semester 2 in another

cheers
Xtrader
 
A

Arvin Meyer

In a form On Current Event:

Select Case Me.txtSemester
Case 1
Me.txt1 = Sum([Grade])
Case 2
Me.txt2 = Sum([Grade])
Case Else
MsgBox "Hey! You didn't tell me there was summer school"
End Select

Use something similar in a report detail's On Format event.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Reno said:
Hey all

I need to find out how to get a database to a a series of numbers based on
whether a certain field has a 1 or a 2 in it

eg
textbox1's control source = sum [grade] if [semester] ="1"
else
textbox2's control source = sum [grade] if [semester] ="2"

i need this so that i get a total of grades for semester 1 in one box
and a total for semester 2 in another

cheers
Xtrader
 
J

John Vinson

Hey all

I need to find out how to get a database to a a series of numbers based on
whether a certain field has a 1 or a 2 in it

eg
textbox1's control source = sum [grade] if [semester] ="1"
else
textbox2's control source = sum [grade] if [semester] ="2"

i need this so that i get a total of grades for semester 1 in one box
and a total for semester 2 in another

Try:

textbox1: Sum(IIF([Semester] = "1", [Grade], 0))
textbox2: Sum(IIF([Semester] = "2", [Grade], 0))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top