TextBox Object Control Source Expresion, trouble with

P

pbalmanno

TextBox to TextBox?

I don't need a SQL solution (wouldn't know how to insert it where-no smart
alecs please) but, is there a way to count all the boxes with specific text
("Desired text") as a result from another expression returning the specific
text to another TexBox?

TextBox [Text459] contains the following expression in the control source
=IIf([FIELD1]="Closed","Closed",IIf([FIELD2]=-1,"text1",IIf([FIELD3]=-1,"text2",IIf([FIELD4]=-1,"text3","Desired
text"))))

For some reason I can't get the following simple expressions to work in a
report TextBox [Text767] control source.
=Count([Text459]="Desired text")
=Sum([Text459]="Desired text")
=DCount("[Text459]","Desired text")
=DSum("[Text459]","Desired text")

Thanks,
 
K

Klatuu

In a report you don't use Count or Sum on a control. You use it on the field
that is the Control Source of the control
 
P

pbalmanno

I didn't get you. I'm putting the expression in the control source of the
textbox. Why do you see the textbox as a control?

Klatuu said:
In a report you don't use Count or Sum on a control. You use it on the
field
that is the Control Source of the control
--
Dave Hargis, Microsoft Access MVP


pbalmanno said:
TextBox to TextBox?

I don't need a SQL solution (wouldn't know how to insert it where-no
smart
alecs please) but, is there a way to count all the boxes with specific
text
("Desired text") as a result from another expression returning the
specific
text to another TexBox?

TextBox [Text459] contains the following expression in the control source
=IIf([FIELD1]="Closed","Closed",IIf([FIELD2]=-1,"text1",IIf([FIELD3]=-1,"text2",IIf([FIELD4]=-1,"text3","Desired
text"))))

For some reason I can't get the following simple expressions to work in a
report TextBox [Text767] control source.
=Count([Text459]="Desired text")
=Sum([Text459]="Desired text")
=DCount("[Text459]","Desired text")
=DSum("[Text459]","Desired text")

Thanks,
 
K

Klatuu

Because a text box is a control. All objects on a form are controls.
What I am saying is that in the text box where you want to show the value,
the expression does go in the control source. What I meant to say is that
you expression is referencing controls on the form. That is not correct.
You reference the name of the fields rather than the controls the fields are
bound to.
--
Dave Hargis, Microsoft Access MVP


pbalmanno said:
I didn't get you. I'm putting the expression in the control source of the
textbox. Why do you see the textbox as a control?

Klatuu said:
In a report you don't use Count or Sum on a control. You use it on the
field
that is the Control Source of the control
--
Dave Hargis, Microsoft Access MVP


pbalmanno said:
TextBox to TextBox?

I don't need a SQL solution (wouldn't know how to insert it where-no
smart
alecs please) but, is there a way to count all the boxes with specific
text
("Desired text") as a result from another expression returning the
specific
text to another TexBox?

TextBox [Text459] contains the following expression in the control source
=IIf([FIELD1]="Closed","Closed",IIf([FIELD2]=-1,"text1",IIf([FIELD3]=-1,"text2",IIf([FIELD4]=-1,"text3","Desired
text"))))

For some reason I can't get the following simple expressions to work in a
report TextBox [Text767] control source.
=Count([Text459]="Desired text")
=Sum([Text459]="Desired text")
=DCount("[Text459]","Desired text")
=DSum("[Text459]","Desired text")

Thanks,
 

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