Solved

Select All CheckBox

Posted on 2003-11-24
2
1,733 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now