Solved

Select All CheckBox

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

733 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