listbox columns

J

JohnE

I have a form with a listbox on it. In the listbox there are multiple
columns. One column(A) displays revenue while another column(B) is a yes/no.
Under the columnA is a textbox that I would like show the total revenue if
columnB is yes. I am struggling with an expression to display the amt but
getting frustrated in not finding it. Can anyone direct me to see an example
or have a solution to it? Both columns are coming from the same table.
Thanks for the assistance.
*** John
 
D

Douglas J. Steele

I'm assuming that the total won't change depending on what's been selected
in the listbox. If that's the case, you're probably best off using DSum as
the ControlSource for the text box. Something like:

=DSum("[Revenue]", "[MyTable]", "[MyYesNoField] = True")

Include the equal sign. Change the field and table names to match what
you're actually are.
 
J

JohnE

Mr Steele, thanks for the info. It works.
*** John


Douglas J. Steele said:
I'm assuming that the total won't change depending on what's been selected
in the listbox. If that's the case, you're probably best off using DSum as
the ControlSource for the text box. Something like:

=DSum("[Revenue]", "[MyTable]", "[MyYesNoField] = True")

Include the equal sign. Change the field and table names to match what
you're actually are.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


JohnE said:
I have a form with a listbox on it. In the listbox there are multiple
columns. One column(A) displays revenue while another column(B) is a yes/no.
Under the columnA is a textbox that I would like show the total revenue if
columnB is yes. I am struggling with an expression to display the amt but
getting frustrated in not finding it. Can anyone direct me to see an example
or have a solution to it? Both columns are coming from the same table.
Thanks for the assistance.
*** John
 
Top