Solved

# In access 2003 multiply 2 text box display result in 4th Text box based on 3rd Text box condition

Posted on 2011-05-10
Medium Priority
434 Views
Dear sir,

I am working in access 2003 and I have recently started I have created form, but I want 2 text boxes to be multiplied and result is displayed in 4th box based on the condition of 3rd box.

In the 3rd box I have fixed the list of 3 options based on selected option in the text box the result should be calculated in the 4th Text Box.

Thanking you

Warm Regards,
0
Question by:venkatramreddy_g
• 5
• 3
• 2
• +1

LVL 16

Expert Comment

ID: 35731635
Ok First you need to decide how the calculation is going to be trigger. I am going to assume that there is a button that you click to run the calculation. So we will use the onclick event of that button and insert the following code

Private Sub ButtonName_OnClick()

Dim strCondition as string
strCondition=Me.TextBox3

Select Case strCondition

Case condition1

Case Condition 2

Case Condition3

End Select

End Sub
0

LVL 16

Expert Comment

ID: 35731672
Sorry forgot the inverted comma around the cases

Private Sub ButtonName_Click()

Dim strCondition as string
strCondition=Me.TextBox3

Select Case strCondition

Case "condition1"

Case "Condition2"

Case "Condition3"

End Select

End Sub
0

LVL 49

Expert Comment

ID: 35731692

you could set the default of the 4th control to a function or an expression which accepts parameters from the first three textboxes.

= (NZ(me.[Field1], 0) + NZ(me.[Field2], 0) + NZ(me.[Field3], 0)

But without knowing more about the values in first two textboxes, a better explaination of what is in the third, and how these relate to textbox 4, we cannot provide much help.

0

LVL 52

Accepted Solution

Gustav Brock earned 2000 total points
ID: 35735442
Set the ControlSource of textbox4 to:

=Val(Nz([txtTextBox1]))*Val(Nz([txtTextBox2]))

Expand this to reflect the condition(?) in textbox3:

=IIf([txtTextBox3]="OK",Val(Nz([txtTextBox1]))*Val(Nz([txtTextBox2])),"Not OK")

/gustav
0

Author Comment

ID: 36094743
I used iif solution for the above condition
0

Author Comment

ID: 36095822
I've requested that this question be closed as follows:

Accepted answer: 0 points for venkatramreddy_g's comment http:/Q_27029623.html#36094743

for the following reason:

I used IIF Solution for my problem
0

Author Comment

ID: 36094762
I slightly modified and used the IIF solution and result is stisfactory
0

Author Comment

ID: 36094774
I couldnt assign the CASE STATEMENT code to form so I couldnt use this solution otherwise is very good solution
0

Author Comment

ID: 36094775
g
0

LVL 52

Expert Comment

ID: 36095823
> I used iif solution for the above condition

- as I suggested? Or how?

/gustav
0

LVL 52

Expert Comment

ID: 36125724
http:#a35735442

/gustav
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all recordā¦
###### Suggested Courses
Course of the Month13 days, 14 hours left to enroll