On Fri, 13 Jul 2007 08:17:46 -0700, rpboll <RPBOLL@gmail.comwrote:
Quote:
>I am looking for the best way to accomplish the following continuous
>forms concept.
>
>There are Five Groups: A, B, C, D, E
>
>
>Each group has eight Members: a, b, c, d, e, f, g, h
>
>
>Each Member is seen as a row in a continuous form like:
>
>A a
>A b
>A c
>.
>.
>.
>A h
>B a
>B b
>.
>.
>.
>Each row (member) has a bound checkbox and a lable: lblCounter
>
>The behavior that I am looking for is -- when you click the checkbox
>for any group, the count for that group is reflected in lblCounter.
>
>Using Group A as an example, if you check member A b (and it is the
>only member of that group selected) then A b's lable shows "1" -- if
>you then select member A g the label updates to "2" and so on until
>your reach "4". If you de-select a member, it's label value
>for that group reduces by 1.
>
>If you exceed "4" checks for a group the number should briefly turns
>into a message like "All
>4 Selected" and then undo the check.
>
>I have a feeling that as simple as this sounds this is difficult task
>with continuous forms.
>
>Thanks for any suggestions,
>
>
>RBolling
Get the count from the underlying table rather than from the continuous form's
recordsetclone. Something like -
Sub CheckBoxControl_AfterUpdate()
Dim intChecked As Integer
Dim strGroup As String
Me.Dirty = False
strGroup = Me.Group
intChecked = Abs(DSum("CheckBoxField","tblMyTable","[Group]=" & Chr(34) &
strGroup & Chr(34)))
If intChecked >4 Then
Beep
MsgBox "All 4 Selected", vbInformation + vbOkOnly
Me.CheckBox = False
Me.Dirty = False
intChecked = intChecked - 1
End If
Me.lblCounter.Caption = intChecked
End Sub
Wayne Gillespie
Gosford NSW Australia