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

Uisng check box to deselect chkbox 1

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi,
I have on a continous form a bound checkbox to select certain records.
In the HDR of the form I have an unbound checkbox that I want to when checked, deselct all the records that have been selected by a checkbox.

I have used this code to select records, but I want to do the reverse.
How can I change this code to do that.

Private Sub CHK2_AfterUpdate()
Dim rst As DAO.Recordset
Set rst = Me.Recordset
With rst
.MoveFirst
Do
.Edit
![CHK1] = Me![Chk2]
.Update
.MoveNext
Loop Until .EOF
End With
End Sub

Many thanks,
kp

 
techkenny1 . . .

An update query would work faster, particularly where large record counts are concerned.
Code:
[blue]   Dim SQL As String
   
   SQL = "UPDATE [purple][B][I]yourtablename[/I][/B][/purple] " & _
         "SET Chk1 = False;"
   CurrentDb.Execute SQL, dbFailOnError
   
   Me.Requery[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top