?
Solved

Select All CheckBox

Posted on 2003-11-24
2
Medium Priority
?
1,741 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

801 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