Solved

Select All CheckBox

Posted on 2003-11-24
2
1,736 Views
Last Modified: 2008-03-15
Access 97 ..

I have a continuous form containing a number of records, each of which has a CheckBox linked to a field [fldUpdate].

I also have an update query that updates the records where the above checkbox = True.

How can I add a further checkbox to the form that will act as a 'Select All' box, i.e. when the Select All checkbox is set to True, the checkbox on each record is also set to True - when the Select All checkbox is set to False the checkbox on each record is also set to False.

I have little knowledge of VB, so please comment any code provided.
0
Comment
Question by:WebMaker
  • 2
2 Comments
 
LVL 1

Expert Comment

by:udir
ID: 9809257
Hi WebMaker
You can do it in 2 ways:
1) If checkboxMain.Value = -1 then
     DoCmd.runsql "Update Tbla1.checkbox
      SetTbl1.[checkbox] = -1
   end if
   me.requery
2)   (First open a recordset)
    rcrdCount = rst.RecordCount
     rst.movefirst  
         for x = 1 to rcrdCount
           rst.edit
            rst![checkbox] = -1
           rst.move next
         next x
       rst.edit    
    rst.refresh
  me.refresh

Hope it helps
Udir

0
 
LVL 1

Accepted Solution

by:
udir earned 125 total points
ID: 9809296
Hi WebMaker
OOOPS
Try this, it works...
Private Sub ww_Click()
  If checkboxMain.Value = -1 Then
    DoCmd.RunSQL "Update tbl1 SET tbl1.checkbox= -1"
   Else
    DoCmd.RunSQL "Update tbl1 SET tbl1.checkbox= 0"
  End If
 Me.Refresh
 End Sub
Udir
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question