[XL2003] get results from a subform back to the main form

D

Dirk Schwidde

hi,

let's say an VBA application has a main form with a button.
A click on that button opens another form, the 'subform'.

On the subform the user can choose from alternatives by using
radiobuttons.

How do I get the choice back to the main form to do some
calculation with it?

Regards
Dirk
 
G

GS

Dirk Schwidde was thinking very hard :
hi,

let's say an VBA application has a main form with a button.
A click on that button opens another form, the 'subform'.

On the subform the user can choose from alternatives by using
radiobuttons.

How do I get the choice back to the main form to do some
calculation with it?

Regards
Dirk

In concept, probably the easiest way would be to use a public var in
your 'main form', that you can pass a value to when the user clicks one
of the radiobuttons in the 'subform'.

In main form declarations area:
Public MyVal As Variant '//to hold any data type


In the subform:
In the radiobutton_click event:
MainForm.MyVal = SomeValue
**I would use one of the type conversion functions here so that MyVal
contains a value readily usable for calcs. (Though, this not really
necessary as you could convert inside the calc process)

If your radiobuttons are in different groups then add a public var for
each group.
 
D

Dirk Schwidde

In concept, probably the easiest way would be to use a public var in
your 'main form', that you can pass a value to when the user clicks one
of the radiobuttons in the 'subform'.

Thanks a lot, works great!

Dirk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top