Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2005, 12:40 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chacquard
Default check box to select all records

Hi

I have a form built from a query. Each data on the form has a check box. I would like to have a check box and when it is checked, all the data's check boxes are checked automatically... how can I do that ? Would it be by using recordsets ?

Tx

Chantal

 
Old January 11th, 2005, 05:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Yup. All bound form's in a .mdb file a bound to a native DAO recordset. Just clone that recordset in you check boxe's click event, and update the value of your Yes/No field.
(Reference the DAO library, of course).

Private Sub chkSelectAll_Click()

    Dim rst As DAO.Recordset

    ' Clone the Form's recordset
    Set rst = Me.RecordsetClone

    ' Update Yes/No field in form's
    ' underlying recordset.
    With rst
        Do Until .EOF
            .Edit
            !CheckBoxField = True
            .Update
            .MoveNext
        Loop
    End With

End Sub

HTH,

Bob

 
Old January 13th, 2005, 09:02 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   The easiest way to do this is to create your check all checkbox (cbxAll), and then use this code on the check box's After Update Event:

'=============================
If Me.cbxAll = -1 Then
   Me.cbxOne = -1
   Me.cbxTwo = -1
   Me.cbxThree = -1
   'etc...
End If
'==============================

   This will store the checked value in your table.

I hope this helps.


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Check BOx kaushikpulpa ASP.NET 2.0 Professional 2 August 30th, 2007 08:01 AM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
multicolored List Box or Select Box sasidhar79 Javascript 1 February 15th, 2005 01:47 AM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 03:04 AM
check for existing records b4 insertion deian Access ASP 11 June 13th, 2004 09:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.