Conditionally enabling a field on a Subform

G

Guest

I created a program whereby the user makes a selection on one form and then
calls another form with a button. The selection from the first form is
passed to the second form. The second form contains a subform. On the
second form I want to enable a field on its subform based on the value passed
from the first form.

I have set the field in question on the subform Enabled = No. If the value
passed from the first form to the second form = Yes, then enable the field on
the subform. If the value passed from the first form to the second form =
No, then leave the field disabled.

I am currently trying to use a macro to accomplish this by using the
SetValue command. I'm pretty sure I have the logic defined correctly in the
SetValue. I think my main question is, what event should I use to get it to
execute correctly?

As a side note, I have also added a button to the second form allowing the
user to go back to the first form (the second form is not closed), make a
selection, and then call the second form again , passing new values to it.
When the new values are passed to the second form again, I need the macro
mentioned above to execute again.
 
G

Guest

You didnt specify how you move value from the first form to the second one,
so I assume you are using the OpenArgs

On the On Load event of the Main form, you can write the code

Me.[SubFormControlName].Form![FieldName].Enabled = Me.OpenArgs
==============================================
For the second question, why not close the form, and open it again?
 

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