ACCESS : Form and SubForm

  • Thread starter etienne.marchand
  • Start date
E

etienne.marchand

Hello,

I have a Form, which includes a SubForm

I would like to use a condition to allow the access to the subform
(whatever the method).
The condition is defined by a field of the Form, and the result of a
Query (that I can execute with a macro)

How can I achieve that ?

Thanks,
 
K

Klatuu

Is a query actually the best way to do this?
Can you be a bit more specific about what you are doing? In most cases, a
Domain Aggragate function is a better choice.
 
K

kingston via AccessMonster.com

Create a procedure in the main form to enable the subform and another to
disable the subform. Open the form in design mode and right-click on the
title bar to Build Event... and select Code. Insert a procedure, name it
EnableSub, choose Sub, and choose Public. The code that goes in this
procedure would look something like:

Forms!MainForm.SubForm.Enabled = True

DisableSub would similarly be:

Forms!MainForm.SubForm.Enabled = False

Now you can use this in your macro. You can also use the conditional field's
AfterUpdate event to check and enable/disable the subform.
 
Top