Delete records with checkboxes in subforms

H

hermanko

Hi all,

I have two subforms on a main form. Each subform displays records with
a checkbox next to it so the user can select records to delete. There
are two subforms because they contain different info but the user needs
be be able to select checkboxes from both simultaneously.

Once any ONE checkbox from either subform is selected, I want to enable
a command button (default is disabled) that is on the MAIN form. The
code i have currently only works for one of the subforms. I cannot even
click on the boxes in the other subform (it's enabled and not locked).

The code:
in both subform's, the checkbox After Update event has the following
VB...

Private Sub Yes_No_AfterUpdate()
Dim rsClone As Recordset
Dim blnChecked As Boolean
Me.Dirty = False
Set rsClone = Me.RecordsetClone
rsClone.MoveFirst
Do Until rsClone.EOF
If rsClone![Yes/No] Then
blnChecked = True
Exit Do
End If
rsClone.MoveNext
Loop
[Forms]![Duplication]!cmd_remove.Enabled = blnChecked
Set rsClone = Nothing
End Sub

This enables "cmd_remove" on the main form if any one box is checked
and disables it again if it is unchecked. The problem is, i have this
exactly code for BOTH subforms in the After Update event, but only the
second subform works. I basically can't do anything on the first
subform.

Please provide assistance. I am not strong with VB and got the above
code from this group earlier.
thanks a LOT!
Herman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top