Passing a calculation to another form

  • Thread starter Thread starter molsonexpert
  • Start date Start date
M

molsonexpert

I have a form with text boxes (not bound to any table) which need to perform
fairly complicated calculations. In order to make the form less
complicated/confusing, I'd like a user to click on a command button (or the
control itself) to open a subform, enter numbers, then have the calculation
automatically entered into a field in the original form when the subform is
closed. The only way I can get this to work the way I want is using a
setvalue in a macro, but I'm sure there's a better way. My way, there would
need to be a separate subform for each calculation, but I'm hoping to use
only one subform for all required calculations.

Any suggestions are welcome.

steve.
 
That is not what subforms are used for....
You could use the 'DoubleClick' event to open a popup window where the data
could be entered. You could then place the results in the original form
control when the popup window is exited. e.g.
Private Sub Form_Close()
[Forms]![frmMyForm]![CalcField] = Me.Calculation
DoCmd.Close
End Sub


Dorian
 
mscertified said:
That is not what subforms are used for....
You could use the 'DoubleClick' event to open a popup window where the
data
could be entered. You could then place the results in the original form
control when the popup window is exited. e.g.
Private Sub Form_Close()
[Forms]![frmMyForm]![CalcField] = Me.Calculation
DoCmd.Close
End Sub


Dorian

molsonexpert said:
I have a form with text boxes (not bound to any table) which need to
perform
fairly complicated calculations. In order to make the form less
complicated/confusing, I'd like a user to click on a command button (or
the
control itself) to open a subform, enter numbers, then have the
calculation
automatically entered into a field in the original form when the subform
is
closed. The only way I can get this to work the way I want is using a
setvalue in a macro, but I'm sure there's a better way. My way, there
would
need to be a separate subform for each calculation, but I'm hoping to use
only one subform for all required calculations.

Any suggestions are welcome.

steve.

Thanks for the reply. I understand somewhat (I shouldn't have used the term
'subform'), but I'm wondering about multiple calculations. Do need to create
a separate popup form for each calculation, or can I use the same one. If
so, how do I reference the text box on original form? My apologies, my
Access isn't bad but could be better.

thanks again.

steve.
 
Back
Top