Calculations in Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

To all
The following is what I have and then what am trying to accomplish:
I have a form that inputs data into tables called patients.
On this form I require the weight of a patient in kilograms.
Now since we dont use the metric systems much today I have added a button
that takes me to a new form to convert lbs to kgs.
On the 2nd form I have an unbound text field to put lbs in and then I have a
bound field , I dont know if it should be a bound field, that I use to
convert the lbs to kgs.
And then I have a button at the bottom to close the 2nd form.

What I want to have happen is the bound field in hte 2nd form to populate
the weight field on the 1st form.

How do I accomplish that?
Thank you
 
The second control on the second form should be unbound. All it's doing is
displaying the results of the calculation. In the after update event of the
second form's first control (the one where you enter the lbs) use the
following code (of course with your own control names)

Sub txtWhatever_AfterUpdate()
Forms!FirstFormName!txtKiloField = Me.txtWhatever / 2.2
End Sub
 
Arvin:
IN the 2nd form 1st field. I went into properties and then into expression
builder and did this:
=[Forms]![Patient]![BirthWeight]=[Text1]/2.2046244
Alas it did not return the value to the first form.
 
Arvin:
I went back into the after update field and instead of expression builder
I choose the Code Builder and went from there.
It worked great with some minor tweaking to the field properties to display
correctly.
THANK YOU !!!!!!!!!

benny wa said:
Arvin:
IN the 2nd form 1st field. I went into properties and then into expression
builder and did this:
=[Forms]![Patient]![BirthWeight]=[Text1]/2.2046244
Alas it did not return the value to the first form.


Arvin Meyer said:
The second control on the second form should be unbound. All it's doing is
displaying the results of the calculation. In the after update event of the
second form's first control (the one where you enter the lbs) use the
following code (of course with your own control names)

Sub txtWhatever_AfterUpdate()
Forms!FirstFormName!txtKiloField = Me.txtWhatever / 2.2
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
The first "=" sign is what was messing you up. I'm glad you figured it out.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

benny wa said:
Arvin:
I went back into the after update field and instead of expression builder
I choose the Code Builder and went from there.
It worked great with some minor tweaking to the field properties to
display
correctly.
THANK YOU !!!!!!!!!

benny wa said:
Arvin:
IN the 2nd form 1st field. I went into properties and then into
expression
builder and did this:
=[Forms]![Patient]![BirthWeight]=[Text1]/2.2046244
Alas it did not return the value to the first form.


Arvin Meyer said:
The second control on the second form should be unbound. All it's doing
is
displaying the results of the calculation. In the after update event of
the
second form's first control (the one where you enter the lbs) use the
following code (of course with your own control names)

Sub txtWhatever_AfterUpdate()
Forms!FirstFormName!txtKiloField = Me.txtWhatever / 2.2
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

To all
The following is what I have and then what am trying to accomplish:
I have a form that inputs data into tables called patients.
On this form I require the weight of a patient in kilograms.
Now since we dont use the metric systems much today I have added a
button
that takes me to a new form to convert lbs to kgs.
On the 2nd form I have an unbound text field to put lbs in and then I
have
a
bound field , I dont know if it should be a bound field, that I use
to
convert the lbs to kgs.
And then I have a button at the bottom to close the 2nd form.

What I want to have happen is the bound field in hte 2nd form to
populate
the weight field on the 1st form.

How do I accomplish that?
Thank you
 
Back
Top