UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Simply Adding Multiple Unbound Text Boxes    
 
   
Jbarbeau
post Jan 5 2005, 11:52 AM
Post #1

UtterAccess Member
Posts: 40



I need to devise a form that will help keep track of my Paramedic and EMT Students Skills.

The Students need to preform certain tasks or have experience with certain skills in order to graduate the class.

All I need to know, is how to add the numbers in an unbound text box so that the total appears in bound text box

For instance, field boxes A1, A2, A3 I want to add together and get a total in AdultTotal (my bound text box). I simply want to record
A1 could = 2
A2 could = 3
A4 could = 3
and I would simply like AdultTotal to = 8

How would one write thin the Control Source ?
Go to the top of the page
 
+
malcolmd83
post Jan 5 2005, 11:56 AM
Post #2

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



The following should work:

=[A1]+[A2]+[A3]

Hope this helps...
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 12:20 PM
Post #3

UtterAccess Member
Posts: 40



Yea, I thought it would too, yet it didnt.

Maybe I can reitterate
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 12:41 PM
Post #4

UtterAccess Member
Posts: 40



When I use the A1+A2 command
my Sum box does this.

say a1 = 2
and a2 = 3

Sum box = 23
it doesnt add them, yet it will mulpiple and subtract, why is this ?
Go to the top of the page
 
+
kikir
post Jan 5 2005, 12:50 PM
Post #5

UtterAccess Guru
Posts: 523
From: Illinois



Make sure you're using a number not text as the field.

Kathy
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 12:53 PM
Post #6

UtterAccess Member
Posts: 40



Kathy, You are the best, thanks for you help!
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 01:24 PM
Post #7

UtterAccess Member
Posts: 40



Another Question.

A1 = 2
A2 = 2
A3 = 2

ASum = A1+A2+A3 = 6
This is what i wanted, yet how do I save this number 6.

I want the Sum to be saved into the database under Adult = 6 ?
I hope this is clear. Since the Control Source now = A1+A2+A3, when I start a new record, ASum or Adult = 0 because the values are Zero.

How do I save the sum ?
Go to the top of the page
 
+
malcolmd83
post Jan 5 2005, 01:36 PM
Post #8

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



One solution would leave the control source of "AdultTotal" bound to the table. Then, create a command button, with the "on click" event:

AdultTotal.Value = [A1]+[A2]+[A3]

This would enable the user to click a button, after filling in the three other fields, and assign the sum value to your "AdultTotal" field and underlying table. Perhaps this will not accomplish what you need, but it's just an idea.
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 02:29 PM
Post #9

UtterAccess Member
Posts: 40



My on Click: event looks like this
=[Adulttotal]=[A0]+[A1]+[A2]
but it doesnt seem to be working. Am I missing something for the command button?
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 02:47 PM
Post #10

UtterAccess Member
Posts: 40



Also, What does this mean:

Does not contain the Automation Object 'AdultTotal.Value' ??

This occurs when I have an OnClick command of:
[Adulttotal.Value]=[A0]+[A1]
Go to the top of the page
 
+
malcolmd83
post Jan 5 2005, 02:48 PM
Post #11

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



In the drop-down in the "On Click" property of the command button, choose "[Event Procedure]". Then, click the "..." button at the end of the field.

This will take you to the VBA editor. Between:

Private Sub Command0_Click()

and:

End Sub

place the code I gave you above...

Hope this helps!
Go to the top of the page
 
+
Jbarbeau
post Jan 5 2005, 04:00 PM
Post #12

UtterAccess Member
Posts: 40



That helped a tremendous bit, I have much accomplished today and I am very happy, thank you very much.

However, I have another question.

Can i put multiple Private Sub Command's on one click ?

I want to do this for 3 fields, and it works well, accept it doesnt update the other 3 like the first one.

I have 3 columns
For example:

Private Sub CalculateTotals_Click()
Adulttotal.Value = Adulttotal.Value + [A0] + [A1] + [A2] + [A3] + [A4] + [A5] + [A6] + [A7]

GeriatricTotal.Value = GeriatricTotal.Value + [G1] + [G2] + [G3] + [G4] + [G5] + [G6] + [G7] + [G8]

PediactricTotal.Value = PediactricTotal.Value + [P1] + [P2] + [P3] + [P4] + [P5] + [P6] + [P7] + [P8]

End Sub

- This seems to work well, accept the first one updates upon click, the others do, but it doesnt show it. If I close the form and open it, the totals have been added.

What could be this problem?
Go to the top of the page
 
+
malcolmd83
post Jan 5 2005, 04:21 PM
Post #13

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



Hmmm... the code you posted should work, as yes, you can have multiple "commands" activated by a single click.

I gather that the sum for the first set appears right away, but the sums for the second two sets do not show as soon as the button is clicked, even though the values have been updated? Have you tried reversing the order of the three strings to see if it is actually the first string in the Sub, or the first set of controls on the form, which are causing the problem?

Perhaps try adding the following after the last string, and before the "End Sub":

CODE
Me.Refresh


Sounds like you are very close to accomplishing what you are trying to do!
Go to the top of the page
 
+
Jbarbeau
post Jan 6 2005, 09:50 AM
Post #14

UtterAccess Member
Posts: 40



Yes, I am very close, Thank You.

The
Me.Refresh command works great, I will have to remember that one
Go to the top of the page
 
+
malcolmd83
post Jan 6 2005, 09:51 AM
Post #15

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



Glad I was able to assist you along the way! All the best with finishing your project.. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+
Jbarbeau
post Jan 6 2005, 10:10 AM
Post #16

UtterAccess Member
Posts: 40



I wasnt aware you were on.

Maybe I can ask you this question that I posted.

"How does one start a new record with all the values = 0 as an integer.

I would like my unbound and bound fields to actually display a 0 in the field upon a new record, and for the records that have been created, say I pull that back up through a search, to display 0's once again in just the unbound boxes.
Is there a onload command that I can devise for the form?"

Thanks again.
Go to the top of the page
 
+
malcolmd83
post Jan 6 2005, 10:29 AM
Post #17

UtterAccess Ruler
Posts: 1,208
From: Cochrane, Ontario, Canada



Hi again. I just looked at your other thread concerning this question, and I would have suggested the same as Scott. If I think of anything else, I'll post it to the other thread. (It's better to address seperate issues each on their own thread.)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 01:43 PM