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

Select All with yes/no field

Status
Not open for further replies.

qws

MIS
Jun 23, 2005
26
AU
Hello,

I have a main form which has a subform in it, and on the main form I want to click a "Select All" button and have all the yes/no fields in the subform populated with a yes value.

I tried looking at a couple of other posts but couldn't work out how to do this. Any help would be appreciated.

Main form is called: abr_week_form
Sub form is called: abr_qry_subform
yes/no field is called ABRsent
 
I think you need an update query:
[tt]strSQL="Update [Table Name] Set ABRSent=True"
DoCmd.RunSQL strSQL[/tt]
 
How are ya qws . . .

In case you have a particular group you want to set to yes (besides others):
[ol][li]Add a question mark [blue]?[/blue] to the Tag property of each yes/no field of interest.[/li]
[li]In the [blue]Click[/blue] event of the button . . .
Code:
[blue]   Dim sfrm As Form, ctl As Control
   
   Set sfrm = [[purple][b]subFormName[/b][/purple]].Form
   
   For Each ctl In sfrm.Controls
      If ctl.Tag = "?" Then ctl = True
   Next
   
   Set sfrm = Nothing[/blue]
[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
Thanks for that both of you! :) It is all working now exactly as I need! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top