Populating the text box’s that relate to the chosen combo box’s with the sum of a cal

patentinv

Registered User.
Local time
Yesterday, 21:39
Joined
Aug 29, 2005
Messages
29
Hi, I'm in the process of building a program in access 2003 for estimating roofs, I've ran into a little problem, as described below. any suggestions would be very useful

Populating the text box’s that relate to the chosen combo box’s with the sum of a calculation.

In other words if X combo box is chosen (There are many combo boxes to choose from) populate xx text box with the sum of a calculation.

Refer to the print screen example of my program: http://www.roofmart.net/Rest.asp

Notice under the label felts the 15lb 36” felt combo box is chosen and it displays the value of 11 and next to the combo box is a text box that displays the value of 25 The calculation will be (11*25) = 275 this value of 275 must be added to the text box values that are being shown in the forms header under 30yr where it reads $4,606.80 and 40 yr $6002.80 only, this is because the 30yr comp and the 40 yr comp combo boxes are the only chosen roof types under the label roof types above the felt label.
Hopefully this makes sense.
Thanks -- Any help with be greatly appreciated.
 
You could put an invisible TextBox on the form with a default value of 0 and include it in your 30yr and 40ys calculations. You can set the value of the invisible textbox in the AfterUpdate event of the ComboBox.
 
RuralGuy said:
You could put an invisible TextBox on the form with a default value of 0 and include it in your 30yr and 40ys calculations. You can set the value of the invisible textbox in the AfterUpdate event of the ComboBox.
Lets make sure I understand.
We'll call the invisible text box (txtInv1) default value=0 with a calculation of (11*25) = 275 in side of it. reads like this in the
control source=[cbofelt1536]*[txtTFelt]
Now in the from header on the example print screen where the 30 and 40 yr calculations go i would include +txtinv1 in both 30 and 40 yr. So by default it adds a O.
And then I would add an after update procedure to the 30 and 40 yr roof type combo boxes or to the 15lb 36” felt combo box, I think its the 30 and 40 yr roof type combo boxes Right? Now you say I can set the value of the invisible text box in here, But How? Can I have an example?
Also there will be close to 30-50 other invisible text boxes in this program, if what we are attempting to do works, Will the after update procedure handle all these updates?
Thanks--I really appreciate your help, Chuck
 
The invisible TextBox would *not* have a ControlSource. In the AfterUpdate event of the ComboBox you would put:
Code:
If Me.cbofelt1536 > 0 Then
   Me.txtInv1 = (Me.cbofelt1536 * Me.txtTFelt)
Else
   Me.txtInv1 = 0
End If
I do not know enough about your complete structure to know if this is the best way to achieve your goals, it was just one solution to the immediate problem you posed. As far as will it handle 30-50, each cbo would have it's own code but there is *no* practical limit to how many it could handle. You might want to come up with a clever naming convention so a code loop could run around and collect the various SubTotals.
 
Last edited:
Hi RG,
I really appreciate your help, Now if I place this code you just sent me in the after update cbofelt1536 combo box, I see hwat we are accomplishing it will place the total in the txtinv1 text box.
Now i have to make this value in the txtinv1 appear only in the form header under the correct roof type that was chosen.
This is where I'm running into problems, I could easily have it populate all rooftypes in the form header by placing +txtinv1 to all text boxes. However this would make the form header full of unnecassary numbers/values.
I need to figure a way to have txtinv1 only appear in the form header under the roof type that is chosen. I'm thinking this is where you suggest a clever code loop. Which I have no idea how to create.

Thanks -- Again for your help, Ireally apprciate it, RG
 
Hi patentinv,
I'm sorry but my idea bucket is empty at the moment. You may just have programmed yourself into a corner with this approach. I usually just walk away from it at this point and let it gel in my head. I've been known to fix programming problems in the shower or in my sleep (seriously). You just stop thinking about it and *bam* the idea comes to you. Let me know if you have any specific problems to resolve and I'll look into them.
 

Users who are viewing this thread

Back
Top Bottom