Link to home
Start Free TrialLog in
Avatar of venkatramreddy_g
venkatramreddy_g

asked on

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

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.

 

Please provide the solution.

 

Thanking you

 

Warm Regards,
Avatar of Sheils
Sheils
Flag of Australia image

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

Your calculation

Case Condition 2

your calculation

Case Condition3

Your calculation

End Select

End Sub
Sorry forgot the inverted comma around the cases

Private Sub ButtonName_Click()

Dim strCondition as string
strCondition=Me.TextBox3

Select Case strCondition

Case "condition1"

Your calculation

Case "Condition2"

your calculation

Case "Condition3"

Your calculation

End Select

End Sub
Avatar of Dale Fye
need a little bit more information.

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.



ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of venkatramreddy_g
venkatramreddy_g

ASKER

I used iif solution for the above condition
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
I slightly modified and used the IIF solution and result is stisfactory
I couldnt assign the CASE STATEMENT code to form so I couldnt use this solution otherwise is very good solution
> I used iif solution for the above condition

- as I suggested? Or how?

/gustav
http:#a35735442
seems to hold the answer.

/gustav