Calculating Text field

  • Thread starter Frank O'Neil via AccessMonster.com
  • Start date
F

Frank O'Neil via AccessMonster.com

I have two forms, Form1 have a dropdown combox that contains field that is
defined as a text in the database. The selection from the combox populate
form2.I want to count how many time a selection of "A" or "B" or "C" in
form2

Example
Form-1 Form-2
Heading-A B C
Field-Cbotext A
"A" B
"B" C
"C" A
B
Total Text1= 2 Text2= 2 Text3= 1

i want to know how to calculate the total in form 2 using the selection
from form1.
 
M

Marshall Barton

Frank said:
I have two forms, Form1 have a dropdown combox that contains field that is
defined as a text in the database. The selection from the combox populate
form2.I want to count how many time a selection of "A" or "B" or "C" in
form2

Example
Form-1 Form-2
Heading-A B C
Field-Cbotext A
"A" B
"B" C
"C" A
B
Total Text1= 2 Text2= 2 Text3= 1

i want to know how to calculate the total in form 2 using the selection
from form1.


Not sure I follow that, but try using this kind of
expression:
=Count(headinga)
in text1 and similar a expression in the other two text
boxes.
 
F

Frank O'Neil via AccessMonster.com

=count(headinga) did not work with text, but it work with numbers.
The heading field is a text. I try text1=Count(A+A) result #error
I try =count(abs(col1 + col2) result #Error. col1= A col2=A
 
M

Marshall Barton

Frank said:
=count(headinga) did not work with text, but it work with numbers.
The heading field is a text. I try text1=Count(A+A) result #error
I try =count(abs(col1 + col2) result #Error. col1= A col2=A


Sorry, but I do not understand what you're trying to say.
Could you explain each field in form2's record source
table/query and provide some sample values?
 
F

Frank O'Neil via AccessMonster.com

Again, Form-1 contains the fieldname from Tabl-1 example of fieldnames in
-Tabl1
-custname
-address
-addres1
-state,Zip
-catergory
Table-1 information is used to create form-1,
Category is defined as a text. So the G or B or F is store in the database
under catergory.
however, in form-1 under the catergory,is a dropdown box(combobox) with
different option of

G-Good
B-Bad
F-Fair

The selection of catergory from form-1 populate form-2 as shown below.

Form-2 - contains the result or the summary of the selection from the
catergory combobox. The user want to know the total account of G,B,F.
Form-2. The option can only be done per record. example display heading
Display headings in this format
Good Bad Fair
G
F
G
B
Total 2 1 1
Question-how to calculate the total in form-2. Let me know what you don't
understand.
 
M

Marshall Barton

So the problem is to calculate the totals in form2's footer
section, right?

If I understand what you're saying, the detail section in
form2 contain 3 text box's all bound to the category field
in table1 by using expressions like
=IIf(category = "G", "G", Null)

If that's an accurate summary, then the totals would be
calculated by using expressions like
=Count(IIf(category = "G", "G", Null)
or
=Sum(IIf(category = "G", 1, 0)
or
=Abs(Sum(category = "G"))
whichever you prefer.

In the future, please explain the problem in terms of
table/query fields and how you want them displayed in form
controls. Data is stored in tables and that data is made
available for use through queries. Forms are only used to
display/edit the data (or to perform calculations not done
in the form's record source query).
 
F

Frank O'Neil via AccessMonster.com

Thank Marshall for this ideas, I will try them.
Are you suggesting that I should put this code on the control source under
the total textbox for each. I would have used query for form-2, but the
selection have different occurance. How I do check for the null value in
the total textbox.
 
F

Frank O'Neil via AccessMonster.com

Since your result is coming from form-1 to populate form-2, how do you
reference form-1 in your code to form-2 because the code is giving me an
error message #name.
=Count(IIf(category = "G", "G", Null)
 
M

Marshall Barton

Frank said:
Since your result is coming from form-1 to populate form-2, how do you
reference form-1 in your code to form-2 because the code is giving me an
error message #name.
=Count(IIf(category = "G", "G", Null)


I do not understand what you are doing here and I now must
assume that my assumptions are incorrect. We need to back
up so I can figure out what form2's RecordSource table/query
looks like. Also explain the ControlSource of each text
box. Is there a relationship of some sort between form1 and
form2??
 

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