cninghm
asked on
How to change + to - programatically in access datasheet form/subform
Hello Experts:
I have a datasheet form with a datasheet sub-form. When the user clicks on the + on the main datasheet form, the sub-datasheet form appears as it should. If (s)he then clicks somewhere on the main datasheet form, I want to make the subform go away (programatically change the + to a - and render the subform inactive). Is there a simply way to do this? I'm not sure how to refer to the + and - button. I'd be happy if I could just close the subform but I don't know how to do that from the main form either. From everything I've seen on the internet, it doesn't look like it's possible.
I have a datasheet form with a datasheet sub-form. When the user clicks on the + on the main datasheet form, the sub-datasheet form appears as it should. If (s)he then clicks somewhere on the main datasheet form, I want to make the subform go away (programatically change the + to a - and render the subform inactive). Is there a simply way to do this? I'm not sure how to refer to the + and - button. I'd be happy if I could just close the subform but I don't know how to do that from the main form either. From everything I've seen on the internet, it doesn't look like it's possible.
ASKER
Actually, I needed to create a subform on the subform, so this won't work. Here's the whole picture:
Main form > Subform1 > Subform2.
When user is in Subform1, expands Subform2, then clicks back in Subform1, I want to close Subform2. This command closes all subforms, unfortunately.
Main form > Subform1 > Subform2.
When user is in Subform1, expands Subform2, then clicks back in Subform1, I want to close Subform2. This command closes all subforms, unfortunately.
We can only answer the Q that is asked.
I don't know of any way to handle you real requirement.
I don't know of any way to handle you real requirement.
ASKER
The real requirement is "I want to make the subform go away" whether or not it is on a main form or on a subform. But, thanks for trying.
I've just been looking further at this and the issue is where you click back to.
If you click back on the subform (from the sub-sub) then only the sub-sub closes.
If you click back onto the main form then all subforms (sub & sub-sub) close.
This seems quite reasonable to me.
If you click back on the subform (from the sub-sub) then only the sub-sub closes.
If you click back onto the main form then all subforms (sub & sub-sub) close.
This seems quite reasonable to me.
ASKER
It's not working for me. I put the command on Subform1.field1. Opened Main > Subform1 > Subform2. Clicked on Subofm1.field1 and it didn't collapse Subform2.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome, thanks. I'll work on mine some more. Not sure what is different about mine, but I'll keep at it. Thank you!
ASKER
I just had to let you know why mine didn't work. I put the command on a field which is a combobox. When I moved the command to a regular field, it worked. Thank you, Peter57r!
Betty
Betty
DoCmd.RunCommand acCmdSubdatasheetCollapseA
However, to allow this to happen when the user clicks anywhere on the main form datasheet you would have to put the command into the click event procedure of every field .