[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

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.
0
cninghm
Asked:
cninghm
  • 5
  • 4
1 Solution
 
peter57rCommented:
You can close all open subdatasheets using:

DoCmd.RunCommand acCmdSubdatasheetCollapseAll

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 .
0
 
cninghmAuthor Commented:
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.
0
 
peter57rCommented:
We can only answer the Q that is asked.

I don't know of any way to handle you real requirement.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
cninghmAuthor Commented:
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.
0
 
peter57rCommented:
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.
0
 
cninghmAuthor Commented:
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.  
0
 
peter57rCommented:
Here's my test db.
Open form StartHere; on the mainform only the shipped date is active in closing subforms, and on the subform, only the Proiductid is active in closing sub-subs.
db14.mdb
0
 
cninghmAuthor Commented:
Awesome, thanks.  I'll work on mine some more.  Not sure what is different about mine, but I'll keep at it.  Thank you!
0
 
cninghmAuthor Commented:
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now