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!

Function to count records (value dependent)

Status
Not open for further replies.

glxman

Technical User
Apr 19, 2007
36
GB
Hi

I have a form that has a list of records with a button next to each for checking data linking criteria to another form. Once the user is happy with the data they return to the form and click a checkbox on that record.

I have a release button at the top of the form that I want disabled until the check boxes are ticked for all records.

I know how to code the enabled true/false but not sure how to get it to recognise that all records showing are checked or not.

I was thinking 2 text boxes:

1. =Count([Complete]) - to count the records
2. =Count([Complete]<>0) - to count records with a check.

Then compare the values of the text boxes to determine whether the button is enabled or not.

I cannot get the count for the checked records to work though. Any ideas?

Thanks
Rich






 
Rich,

You may just use the Form Recordset Clone (ADO recordset) to check.

Code:
'some code to save the record after use clicks the checkbox

dim rst as ADO.Recordset
dim boNotAllChecked as boolean
boNotAllChecked=false
set rst=Me.form.recordsetclone
if not rst.BOF then
    rst.movefirst
end if
while not rst.Eof
    if rst!Completed=false then
        boNotAllChecked=true
    end if
    rst.movenext
wend

Releasbutton.Enabled=Not boNotAllChecked

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top