I have a form where sample analytical values are posted to table t_Samples. The user gets a report from a lab where sample data percentages are either expressed on an as-is (water included) basis or on a dry (water excluded) basis. I want the user to be able to enter the water % of the sample (always given) and then enter either the as-is or the dry sample percentages depending on how data has been provided.
For example: A sample that is 10% water (90% dry) with an as-is protein content of 20% (20% of the weight - including water weight - is protein) would have a dry protein content of 0.2 / (1-0.1) = 22.22%. A sample that is 10% water with a dry protein content of 20% (20% of the dry weight - no water weight included - is protein) would have an as-is protein content of 0.2 * (1-0.1) = 18%
I would like the user to be able to put values for protein in either of two text boxes and have the form calculate the other based on the water % of the sample. The form then submit just the as-is value to the table together with the water content.
Conceptually the calculation is circular, but the user would only enter one of the values (dry or as-is), the other would be calculated based on what data was provided and the water content. You would not know which value the user would have. I would like to display both (one entered, one calculated) once one has been filled in.
I would like to do this not using VBA if at all possible although if needed or appropriate I could use it (I'm a noob). I also have several sample constituents (protein, fat, ash, fiber) on the same form and all would have two text boxes (dry or as-is) side by side and a single sample water content for that sample.
Conceptually its similar to Celcius or Fahrenheit or English units vs Metric if you dont know which will be received. Any help would be appreciated.