write code for the plus sign on a datasht View sub form

BBBryan

Registered User.
Local time
Today, 13:36
Joined
Nov 13, 2010
Messages
122
Hi,
I have a Form (WO fm) and a sub form (Info fm).
In the Form (WO fm) I have a checkbox named [Active].
In datasht view I want to click on the plus sign (to Open the subForm) for a certain WorkOrder.
I want a checkbox [Active] to be checked (true) and all checkboxes [Active] to be unchecked (False).
I am not sure where or what this plus sign is called to write the code.

Also when I click the plus sign (to Close the subForm) I want update a textbox named [Update] to show todays date.

Thanks Bryyan
 
The "plus sign" open a subdatasheet. This is not a subform.

If you have a subdatasheet visible it means the Source Object of your form is a table or query. Unfortunately this is what the Access Form Wizard does if the table has a subdatasheet.

This is not a good way to present data because you have no control over the user interaction with the data, no Events and no formatting.

There is no code to open the subdatasheet except via SendKeys which is considered a last resort to control the program.

You need to reconsider the whole approach to the design and learn how to create subforms that use forms as their Source Object. Forget about subdatasheets. They can be useful whant interacting with the tables during the design phase but they should never be part of the user interface.
 
Thanks
I wanted to use this as a datasht view because it is easier to see all of the data vs Continuous also the use can copy and paste whole Row if it is simular(For Quickness).

I will have to use the Continuous View

thanks again
 
I think we might be on different pages here. My impression is you have form with a subformcontrol and the Source Object of that subformcontrol is a query or table.

In my experience the subdatasheet is available only on a table or query. A form object does not support a subdatasheet even if it is in Datasheet view.

Using a form as the subformcontrol's SourceObject still allows the Datasheet view but does not show a subdatasheet. Usually the alternative to a subdatasheet is a subform.

However since Datasheet (and Continuous Forms) do not support subforms this limitation is worked around by having both the Master Form and Child Form displayed as subfoms on the main form. The Link Master and Link Child Fields are connected via textboxes on the main form.
 
Hi GalaxiomAtHome,
Thanks for your responce
I am not sure how you call this - but what I have is a Form in Datasht view. The Form is called WO fm and with in this form is the sub called (Info fm). All in the same form.
In Datsht view I have the plus sign when opened goes to the Sub form (Info fm) in datasht view. I can change it back to a Continuous/Single form etc..
What I was trying to do was when I click on this + Plus sign was write a code like you would as if it were in Form view. On Open do this / On Close do that. But I do not know what to call this plus sign in the code.

Thanks BBryan
 
I am not sure how you call this - but what I have is a Form in Datasht view. The Form is called WO fm and with in this form is the sub called (Info fm). All in the same form.

:confused: A datasheet form does not support subforms.

Can you post a sample database with just the essential objects and a few dummy recorsds? Compact the database and zip it before posting it.

What I was trying to do was when I click on this + Plus sign was write a code like you would as if it were in Form view. On Open do this / On Close do that. But I do not know what to call this plus sign in the code.

There is no code to call the plus sign except to use the SendKeys function.
 
Hi GalaxiomAtHome,
Here is the Database
The form is Workorder from



Thanks BBryan
 

Attachments

Thanks for posting the database BBryan. It cleared up why I was misunderstanding your posts and I learnt something.

A long time ago I was wanting to set up a form with subdatasheets and someone here told me I would need to use a table or query as a SourceObject. Well obviously it can be done using subforms as you have and now I know how to do that.:o

Myth busted. As most of us are self trained we often carry the myths we learned early and it is always great to clear one out.:)

Back to your issue. AFAIK, the record selector section of the form, including the subdata control, doesn't have any means of being addressed with VBA. So it is not possible to directly fire the action of pressing the plus sign and there is no event associated with that action.

I have tried everything I can think of to hack a solution but unfortunately have not come up with anything that does what you want.

Incidentally, if you do come up with some ideas this might help.
Here is the code to open and close the subdata plus sign of the current record using SendKeys. Like many SendKeys solutions it can be temperamental.

The following commands send (Shift + Control + Up) and (Shift + Control + Down) respectively.

SendKeys "+^{DOWN}"

SendKeys "+^{UP}"
 
Hi GalaxiomAtHome,
Thanks for your all your Help.
 
Sorry I couldn't come up with a solution. I like to think that most things are more or less possible in Access. I guess this one is less.;)
 

Users who are viewing this thread

Back
Top Bottom