By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

How to UnCheck Checkbox in Subform

P: 72
Hello Friends

I have to create a Transmittal to send some drawings to our Subcontractor. Now what I do.... when I press AddNew Button, it work like this....

Main form open with fields.....

User.... = by selecting from combo box
Today's Date = Automatically toddays
Receiving Department = By selecting Combo Box
Job Completion Date = Automatically Date + 30 days

Now I have a subform and I select Drawings by Checkbox.... Then Save this record and Print... This every thing is OK...

Now I want to create an other record.... and I press Addnew button.... previously selected records still selected...

I want when I press AddNew button.... the selected records in Subform should be Uncheck / Clear...

Kindly help me how to do this.... Checkbox name is "ForPrint"
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,561
Let's start with a direct answer for you. Referring to Items on a Sub-Form shows how you can reference a Control on your Sub-Form from the code associated with the main Form :
Expand|Select|Wrap|Line Numbers
  1. Me!YourSubform.ForPrint = False
That's just one potential form of the code.

Now, I think it makes sense for me to advise against whatever it is you're doing. I have to guess somewhat as you haven't said what the name of your Sub-Form is, or given any clues as to its design, but whatever design you have is almost certainly not a good one.

As you mention that the CheckBox needs to be cleared with code I assume the CheckBox is not bound (IE. Not associated with a Field from the underlying RecordSource). If the Sub-Form contains records that there may be more than one of then you would probably be using it in Continuous Form view. To do so with an unbound Control makes no sense (See Why Values in Unbound Form Controls do not Persist). If there can only be one record, or even if the Sub-Form is linked to the same data as your main Form, then putting the CheckBox on the Sub-Form instead of the main Form makes no sense. It's just an unnecessary complication.

In short, and looking at all the scenarios I can think of, I can see none which would make what you're asking about make any sense. I've told you how you can do it if you feel you must, but the more important message is to reconsider your design. Bad design makes for many headaches.
3 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.