Saleve
asked on
How do I refer to a subform in order to change its properties?
How do I refer to a subform in order to change its properties? 1) When I first open the main form, I would like subformA to show no records and not accept new records. 2) Once a record is selected in subformB, I would like subformA to accept new records.
Thanks, Saleve
Thanks, Saleve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to watch the order of events, seems counter intuitive, but sub form initialization and loading comes before the main forms On Load event fires.
With that said, what your doing should be working. However you may need more than AllowEdits to achieve what you want. For example, you may want to set DataEntry to true as well.
Jim.
With that said, what your doing should be working. However you may need more than AllowEdits to achieve what you want. For example, you may want to set DataEntry to true as well.
Jim.
There's also .AllowAdditions and .AllowDeletions
Jim.
Jim.
ASKER
Hi Jim,
(I thought that I had posted a response to you but I screwed it up...)
Yes, I just realized that I was getting .AllowAdditions confused with .AllowEdits.
I'm just getting back to Access after a LONG hiatus and I am really rusty. It's amazing how much one can forget after 10 years (and two kids). Time to hit the books!
Thank again!
Saleve
(I thought that I had posted a response to you but I screwed it up...)
Yes, I just realized that I was getting .AllowAdditions confused with .AllowEdits.
I'm just getting back to Access after a LONG hiatus and I am really rusty. It's amazing how much one can forget after 10 years (and two kids). Time to hit the books!
Thank again!
Saleve
ASKER
It half works. When I use that notation to, for instance, make the sub form not visible on loading the main form, it works. But when I use this code on the on "load" of the main form, edits are still allowed on the subform although I don't get an error:
Forms![Main]![embSubCatego
As I mentioned, I know that I am correctly referring to the subform because it works with .visible = false.
Saleve