setting subform properties based on main form field

G

Guest

I have a main form which contains a subform. I have a 1 to many relationship
for the main form to the subform entries, and have a keyid in both that
links the two together.

In the main form I have a status code combo box. If the value of this
status code is QAR, I want to make the main form read only, as well as the
sub form.

I created some VB code to evaluate the status code field and have
successfully locked out the main form. I tried evaluating the same field in
the sub-form properties, under current record by referencing the main form
name. I seem to be out of sync. If I am focused on Main form record 2 for
example , the sub form read only status seems to be looking at the status of
whatever previous main form record (say record # 10) I was just focused on.

Any thoughts.

Thanks for your help
 
G

Guest

Just disable the subform control, by which I mean the main form's control
which houses the subform. Put something like this in the main form's Current
event procedure:

Me.YourSubformControl.Enabled = (Me.StatusCode <> "QAR")
 
G

Guest

Thanks Ken, I hadn't thought about setting the sub-form properties from the
main form. Which makes perfect sense cuz that's where I set the main form
properties.

Works great. Thanks for you help.
 

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