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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling tick box's accross various forms?

Status
Not open for further replies.

Maillme

Technical User
Mar 11, 2003
186
NL
Hi there,

I have a form, with a subform:

Main: document_log
Sub Form: sign_off

My main form has a tick box (boolean) yes/no.

My Subform has various records, and each record has a sign off tick box(boolean) yes/no.

What i would liek to happen is the following:

If i all the records within my sub form have their tick boxes as ticked (boolean = 1) then the main tick box within the main form is ticked as yes.

Also, vice versa if possible, so that if they tick the main tick box on the main form, all the records in my subform have their tick box's ticked (boolean = 1).

many thanks,
Neil
 
How are ya Maillme . . .

Two SQL update queries and a little logic should do. The following is an example.

In the AfterUpdate event of the document_log checkbox:
Code:
[blue]   Dim db As DAO.Database, sfrm As Form, SQL As String
   
   Set db = CurrentDb
   Set sfrm = [sign_off].Form
   
   SQL = "[purple][b][i]Your SQL to update all checkboxes on subform[/i][/b][/purple]"
   db.Execute SQL, dbFailOnError
   sfrm.Requery
   
   Set sfrm = Nothing
   Set db = Nothing[/blue]
Next, in the AfterUpdate event of the sign_off checkbox:
Code:
[blue]   Dim db As DAO.Database, SQL As String, Cri As String
   
   Set db = CurrentDb
   Cri = "YourCriteriaHere"
   
   If DCount([CheckboxName], "subFormTableName", Cri) = _
      Me.Recordset.RecordCount Then
      SQL = "YourUpdateSQLForMainForm"
      db.Execute SQL, dbFailOnError
      Me.Parent.Requery
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi Ace Man,

thanks alot fo the response - unfrotunately, i have no SQL experience? What SQL should i use?

many thanks,
Neil
 
Maillme . . .

I just happened to check. Apparently I received no notice of your return.

Post the [blue]RecordSource[/blue] of mainform & subform . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
C'mon Maillme! . . .

If you not sure how to get the info, just ask! [thumbsup2] We'll guide you thru it! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top