PC Review


Reply
Thread Tools Rate Thread

check - uncheck in a continuous form

 
 
jean.ulrich@snclavalin.com
Guest
Posts: n/a
 
      14th May 2006
Hi

I have an unbound form name "Letter "
On this form I have a continuous form named "frmEmployees" linked
with the table "tblEmployees"
In the continuous form I have many fields including "City" and
"Choice" both linked with table "tblEmployees"
Field "Choice" is a check box (yes/no)

Suppose I make a filter on New-York city, I want to use a button placed
on the from header of the "frmEmployees" that when I click on it
all the check boxes "Choice" for New-York will become checked.
Then I filter for Denver and by clicking the same button, all the
"Choice" check boxes for Denver will be checked
Of course I can check some other records if I want
So at the end all check boxes for New-York all check boxes for Denver
plus all other single boxes I have check are checked.

I also want a second button that I will use to uncheck all check boxes.

Thanks for helping me

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      14th May 2006
Use the AfterUpdate event procedure of the unbound check box to execute an
Update query statement so that all the entries matching the form's filter
are set to Yes

Private Sub chk1_AfterUpdate
Dim strSql As String
If Me.chk1.Value And Me.FilterOn Then
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
strSql = "UPDATE [Table1] SET Choice = True WHERE " & Me.Filter
dbEngine(0)(0).Execute strSql, dbFailOnError
End If
End Sub

To reset all boxes to unchecked again, execute this string:
strSql = "UPDATE [Table1] SET Choice = False WHERE Choice = True;"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have an unbound form name "Letter "
> On this form I have a continuous form named "frmEmployees" linked
> with the table "tblEmployees"
> In the continuous form I have many fields including "City" and
> "Choice" both linked with table "tblEmployees"
> Field "Choice" is a check box (yes/no)
>
> Suppose I make a filter on New-York city, I want to use a button placed
> on the from header of the "frmEmployees" that when I click on it
> all the check boxes "Choice" for New-York will become checked.
> Then I filter for Denver and by clicking the same button, all the
> "Choice" check boxes for Denver will be checked
> Of course I can check some other records if I want
> So at the end all check boxes for New-York all check boxes for Denver
> plus all other single boxes I have check are checked.
>
> I also want a second button that I will use to uncheck all check boxes.
>
> Thanks for helping me



 
Reply With Quote
 
jean.ulrich@snclavalin.com
Guest
Posts: n/a
 
      14th May 2006
Hi
there is no unbound check box
Check box "Choice" is a field in "tblEmployees"
so i cannot us the after update event like you said
Script should be place on the On Click event of the button

thanks

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      14th May 2006
Okay. Put the code in the click event of your command button.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
> there is no unbound check box
> Check box "Choice" is a field in "tblEmployees"
> so i cannot us the after update event like you said
> Script should be place on the On Click event of the button
>
> thanks



 
Reply With Quote
 
jean.ulrich@snclavalin.com
Guest
Posts: n/a
 
      14th May 2006
Thank Allen

The code was ok to put on the button except for the
"If Me.chk1.Value And Me.FilterOn Then "
that I have to replace by
"If Me.FilterOn Then "

Thanks gain, it works fine now

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I uncheck numerous Excel2003 form toolbar check boxes? Bryan Microsoft Excel Worksheet Functions 1 28th Jul 2008 06:31 PM
Check box on continuous form Design by Sue Microsoft Access Form Coding 14 19th Feb 2008 05:59 PM
Check all check boxes in a continuous form Danny Morales Microsoft Access 2 25th Jul 2007 01:44 AM
check box on continuous form =?Utf-8?B?REJyb3du?= Microsoft Access Forms 2 17th May 2005 10:20 PM
Check box on continuous form =?Utf-8?B?VGhlIEdyYXBlIEh1bnRlcg==?= Microsoft Access Forms 2 5th Jan 2005 02:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.