Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to create an Access program that has to perform the calculation

Status
Not open for further replies.

CHTHOMAS

Programmer
Jun 16, 1999
106
AE
I want to create an Access program that has to perform the calculations in the following way.<br><br>&nbsp;I have 3 tables. 1 main and 2 sub tables. <br><br>&nbsp;MainTABLE1 <br>&nbsp;----------------- <br>&nbsp;Pressure <br>&nbsp;Temperature<br>&nbsp;Level<br>&nbsp;Flow<br><br>&nbsp;SubTABLE2 <br>&nbsp;--------------------- <br><br>&nbsp;Pressure <br><br>&nbsp;1. Operating Pressure <br>&nbsp;2. Design Pressure<br>&nbsp;3. PSV Set Pressure<br><br>&nbsp;Temperature<br><br>&nbsp;1. Temp a<br>&nbsp;2. Temp b<br><br>&nbsp;Level <br><br>&nbsp;1. Level a<br>&nbsp;2. Level b<br><br>&nbsp;Flow <br><br>&nbsp;1. Flow a<br>&nbsp;2. Flow b<br><br><br>&nbsp;subsubTABLE3<br>&nbsp;-------------------------<br>&nbsp;Tag(primary);VAL1;VAL2;FRMULA1;FRMULA2<br><br><br>That is if the Main is Pressure then it can be either Operating or Design or PSV Set.Also if it is Opeating then there could be entries with primary key Tag followed by val1 and val2 which the user enters and then the result is based on Formula1 and Formula2.<br><br>My problem is the Formula which computes the result varies depending on whether it is pressure or Temperature etc. and if pressure then whether Operating, Design etc.<br><br>&nbsp;Please advise me about the following<br><br>&nbsp;1) I am planning to create a 1 to many relations beteween 3 tables? Am i right?<br><br>&nbsp;2)How to handle the varying formula depending on the Main and Sub<br><br>&nbsp;3)My user wants it in such a way on the form that he should be able to select the Main(eg. Pressure)followed by the sub(Operating or Design or PSV)and then he wants to input the Tag(primary)followed by the value1, value2 which displays the results all on the same screen. Is this Possible? if so how to do that?<br><br>Any help or suggestions will be highly appreciated<br><br>Thanks and Regards<br><br>Charley
 
Well VBA code never failed me yet.<br>I could be IF statements like so<br>-----------------------------------<br>If pressure Then<br>&nbsp;&nbsp;&nbsp;&nbsp;If Operating Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Calculate something<br>&nbsp;&nbsp;&nbsp;&nbsp;ElseIf Design Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Calculate something different<br>&nbsp;&nbsp;&nbsp;&nbsp;ElseIf SomethingElse Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Cal something else entirely<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;Somethings missing in Operating&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br><br>ElseIf Temperature Then<br>&nbsp;&nbsp;&nbsp;&nbsp;'Temp Calcualtions<br>Else<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;Houston we got a problem&quot;<br>End If<br>---------------------------------------------<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top