Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 August 14th, 2007, 09:04 PM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checkbox select all

Hi

I inherited a database and changed a few things to make it a bit more user friendly. So I didn't lose any of the old database I made a duplicate but now the "select all check box" won't work. The check box is meant to select all records in a sub form. Here is the code:

Private Sub AllDivisionsCheckbox_AfterUpdate()

    Dim SQL As String

    Me.Refresh
    DoCmd.SetWarnings False

    If Me![AllDivisionsCheckBox] = True Then

        SQL = "UPDATE tblAllDivisions SET tblAllDivisions.[Coord request no] = Forms![frmCoordReq Form]![Coord request no];"
        DoCmd.RunSQL SQL

        SQL = "INSERT INTO tblDivisionsRequested ( [Div request sent to], [Coord request no] )SELECT tblAllDivisions.[Div/State abbreviation], tblAllDivisions.[Coord request no] FROM tblAllDivisions;"
        DoCmd.RunSQL SQL

    End If

    DoCmd.SetWarnings True

End Sub

Private Sub subformDivisionsRequested_Query_Enter()

Me.Refresh

End Sub

Private Sub subformDivisionsRequested_Query_Exit(Cancel As Integer)

Me.Requery


End Sub

The checkbox works fine on the old database and all the tables, queries and forms have the same names in the new one.
Can anyone see my problem??
Can anyone please help me??
Thanks
 
Old August 16th, 2007, 06:37 PM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I fixed it by just using the old database form. Somehow when I compacted and repaired to get my auto-numbering to start at one it made the check box stop working. So now instead of starting at one I'm starting at 215. Oh well, I might just have to live with it!!
 
Old August 17th, 2007, 07:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Odd... the number a record gets with autonumbering should not even consider into your checkbox code. The numbering (and whether it's sequential or not) is something a user never sees or deals with at all. It's solely behind the scenes to connect a primary and foriegn key. Your checkbox code should simply set all checkboxes in the subform to true or false for those records that the foriegn key match the primary key.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Rows From A datagrid without a checkbox nkrust ASP.NET 2.0 Basics 0 January 10th, 2007 01:34 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Select all checkbox in child grid bala24 General .NET 0 May 30th, 2006 01:35 AM
select all in checkbox to print babywind BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 February 11th, 2005 03:14 AM





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