Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform a check to see if any checkboxes are unticked on closing form

Status
Not open for further replies.

redbase

Technical User
Nov 21, 2002
21
GB
I am displaying a series of records in a datasheet format which have a checkbox field that the user should tick to confirm they have checked each record.

On closing the form I need a popup to inform the user that there is at least one unchecked record and give them the option to continue with some unchecked or to tick all records as checked, or to cancel.

I also hope to use part of this code to create a button on the from to tick all of them as checked with one click.

I have tried a few loop options but just can't get my code to do the job properly. Please can anyone help me?

Thank you

Jon

 
Use the on_close event. That is the last thing that happpens when closing a form. Just put your own close, disable the normal close and make the check. Don't let the Rascals out till they do it Right!!!


Rollie E
 
Thanks for this. I guessed that the on_close event would be the most appropruiate place to add the test.

The way I am planning to do it is to use the on_close event to run a procedure that tests the checkbox in each record of the datasheet form to make sure they are all TRUE. If it finds a FALSE condition it will run a pop up box with 3 buttons:

1. Mark all checkboxes TRUE and close the form

2. Continue to close the form with some checkboxes set to FALSE

3. Cancel pop up and return to the datasheet form displaying all of the records with checkboxes unchanged

The bit I'm stuck with is the code to:

1. test the checkboxes to see if any are unticked

2. mark all of the checkboxes as ticked

If you are able to point me in the right direction I would be most grateful.

Many thanks

Jon

 
Thanks for your help.

This works but only if any records exist. If there are no records then there are no checkboxes to test.

My datasheet has a requery facility that will get rid of records that have been checked and bring in new records that are waiting to be checked. If there are no records then the datasheet is completely blank and on_close I get a runtime error that say you have entered an expression that has no value.

How can I get round this?

Thanks



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top