?
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
14
Medium Priority
?
434 Views
Last Modified: 2012-05-11
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,
0
Comment
Question by:venkatramreddy_g
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 16

Expert Comment

by:Sheils
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

Your calculation

Case Condition 2

your calculation

Case Condition3

Your calculation

End Select

End Sub
0
 
LVL 16

Expert Comment

by:Sheils
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"

Your calculation

Case "Condition2"

your calculation

Case "Condition3"

Your calculation

End Select

End Sub
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 35731692
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.



0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 52

Accepted Solution

by:
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

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

Author Comment

by:venkatramreddy_g
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

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

Author Comment

by:venkatramreddy_g
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

by:venkatramreddy_g
ID: 36094775
g
0
 
LVL 52

Expert Comment

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

- as I suggested? Or how?

/gustav
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 36125724
http:#a35735442
seems to hold the answer.

/gustav
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question