views:

298

answers:

2

Good day

Created table(Team) with 3 fields namely:(Player_Name, Player_Class, Add_Player)

The field (Add_Player) is a YES/NO or check-box field

I created a form_A, created a subform_AB to display THE TABLE(Team) When I check the Add_Player, I created a Query to read only those player_names who are checked.

AND THEN CREATE A REPORT ON QUERY.

Problem is how do I un-check all players selected on form-load, by changing teams the other team players that were checked also appear on my report, SO is there a way to un-check all check-boxes on form load

the check-boxes are within a sub-form

A: 

Assuming your subform is a bound tabular form, you can do this in the Form_Load event:

DoCmd.RunSQL "Update TEAM Set Add_Player = False"

Unfortunately this will cause the user to have to respond to a prompt. To avoid that:

Dim xSql As String
Dim xDb As Database
Set xDb = CurrentDb
xSql = "Update TEAM Set Add_Player = False"
On Error Resume Next
xDb.Execute xSql, dbFailOnError  
If Err<>0 Then MsgBox "Error occurred"
Set xDb = Nothing
A: 

@ Paul Layman

Thanks I tried similar code, could not get it to work, Yours does wonders,

Thanks again