473,883 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deselect all checkboxes in Access 2007 form

9 New Member
Beginner seeking expert help.

I have created a split-form (Form_ChkBx)to display records in my table (MST_Table). The bottom portion of the split-form has datasheet view, the top portion has two control buttons, "Clear" & "Exit".

I would like to program the "Clear" button to loop through the form or table and deselect (clear or reset) all checkboxes.

What kind of adjustments will I need for this code?
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Dim chk As CheckBox
  3. Dim Ctl As Control
  4.  
  5. For Each Ctl In Me.Controls
  6.  
  7. If Ctl.Properties("ControlType") = acCheckBox Then Ctl = False
  8.  
  9. Next Ctl
  10.  
  11.  
  12. End Sub
Jun 13 '11 #1
9 11299
ADezii
8,834 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1. Dim Ctl As Control
  2.  
  3. For Each Ctl In Me.Controls
  4.   If Ctl.ControlType = acCheckBox Then Ctl = False
  5. Next Ctl
Jun 13 '11 #2
NeoPa
32,584 Recognized Expert Moderator MVP
Bob,

There seems to be a little misunderstandin g here. When you say clear all the checkboxes on your form, I assume you really mean you want all the values reset to False in the recordset the form is bound to yes?

If so you need something like :
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdClear_Click()
  2.     With Me.Recordset
  3.         Do While Not .EOF
  4.             If !FieldName Then
  5.                 Call .Edit
  6.                 !FieldName = False
  7.                 Call .Update
  8.             End If
  9.             Call .MoveNext
  10.         Loop
  11.     End With
  12. End Sub
We don't know the names of all your fields/objects etc so you'll have to adapt it to your database.
Jun 13 '11 #3
Bob White
9 New Member
Yes - your assumptions are correct. I would like to reset all checkbox values to false. I will let you know how it go.

Thanks Again.
Jun 13 '11 #4
Bob White
9 New Member
Hi NoePa,

Still no success when running the code shown below. Other words, the code does not reset or clear my checkboxes. In fact, all check boex seems to be locked in the checked or unchecked position.

Right now, I'm clueless as how to regain the ability to select and deselect check boxes on the current split-form.

Any suggestion would be greately appreciated.
Otherwise I'll need to recreate a new split-form.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Clear_All_Butt_Click()
  2.     With Me.Recordset
  3.         Do While Not .EOF
  4.             If !PRNT Then
  5.                 Call .Edit
  6.                 !PRNT = False
  7.                 Call .Update
  8.             End If
  9.             Call .MoveNext
  10.         Loop
  11.     End With
  12.  
  13.  
  14. End Sub
Jun 14 '11 #5
NeoPa
32,584 Recognized Expert Moderator MVP
There are many things that could conceivably go wrong with this code, but I can't see that a permanent redesign of the form is a possibility. Does it not revert to those controls being updatable if it's closed and reopened? If not, then I would assume that you have made other changes which are not related to this code.

Also, can you tell me what you see in the table itself if you look at the records after this code has run? Do they reflect what is visible on the form or are they updated as you would expect the form to be?
Jun 14 '11 #6
Bob White
9 New Member
When I add the code tage prefix
Expand|Select|Wrap|Line Numbers
  1.  to the first line, I get a compile Error "Expected: epression". Adding the code tage subfix 
also generates a compile error.

Here is what I'm working with.
I have a simple table with four columns or fields and ten rows or records. The column headings are "ID", "PRNT", "HypLk" and "Info". The ID field show numbers 1 through 10 representing 1- records. PRNT field show one checkbox for each record. HypLk field contains a unique path location and file name (hyperlink)for each record. The Info field contains texted information related to the hyperlink attachment.

My current slpit-form is linked to my table. It has four control buttons "Print All", "Save All", "Clear All" and "Exit". All four buttons area located in the header (top screen area)with the datasheet view of my table in the bottom screen area.

I would like to program the "Clear All" button to deselect or reset all check boxes located in the "PRNT" field of the current form to the unchecked possition. Allowing the opportunity to reselect multiple check boxes for the next multiple print operation.

Thanks,
Bob
Jun 14 '11 #7
NeoPa
32,584 Recognized Expert Moderator MVP
Right. Let's handle one thing at a time. [ CODE ] tags are required for posting code in a thread. They are relevant only to posting on this site. They are not meant to be included in any code within your project.

Now I've read the rest of your post it seems to be a re-iteration (with perhaps some more detail) of what you'd already shared. It's not unhelpful, but doesn't take us forward anywhere.

The questions and requests for information in my previous post (#6) all appear to have been overlooked. I can't help you unless you respond to these.
Jun 14 '11 #8
Bob White
9 New Member
Ok, so CODE tages are require for posting code in a thread on this site. It is my assumption that CODE tages used much like quotaion marks are used in writing; to identify the start/end of a code string?

Regarding question from post #6 - When I press the buttom to run the code, from split-form, nothing happens. No changes occured in the table. The three check boxes that were checked before running the code never changed. The only thing happened after running the code was that all check boxes locked-up. I am unable to check boxes that were previously uncheck and unable to uncheck boxes previously checked. Again running the code generated no change in the table or the form.

Thanks,
Bob
Jun 14 '11 #9
NeoPa
32,584 Recognized Expert Moderator MVP
Bob,

See [code] Tags Must be Used for more on the CODE tags. I hope that will make everything perfectly clear, but if not please let me know by PM and I will clarify.

Your second paragraph confuses me somewhat. Not because it's not pretty clear what you are saying, but because I can't imagine what may be occurring. If you'd like to attach a copy of your database for me to look at for you please go ahead (after checking out Attach Database (or other work)).
Jun 15 '11 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2360
by: bloukopkoggelmander | last post by:
Hello all I just wondered if anyone has come accross the problem in Access 2007 that when you base a form Control Source on a query and then view the form in form view, all you get is a blank form with a tiny horizontal black line in the top left corner. If you switch back to design view you are able to see all you text/combo/list boxes again???? Does anyone have any idea why this happens? Thanks
1
2489
by: taila | last post by:
Hello everyone on this forum, I have recently started learning how to use ACCESS 2007 to create databases for work purposes. I ran into a problem while creating a form. Here's the message that popped up: Field List No fields available to be added to the current view. The current recordsource may be invalid (for example, it may contain an invalid join expression), or there was some other problem gathering recordsource information...
7
4153
by: Icarus | last post by:
I have a Access 2000 database that I am opening with Access 2007. When I open the datbase in Access 2000 or Access 2003, the database runs as expected. In Access 2007 my main form opens, a form with multiple tabs and subforms, the form now takes a "very" long time (more than 10 minutes) to load. Has anyone come across this before, and if so were you able to fix it?
5
9799
by: sphinney | last post by:
Basic question: Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document? Reason for asking: My office is about to receive 100+/- Word 2007 documents that contain data that needs to be imported into various fields of an Access 2007 table. To facilitate the import process, I was thinking of creating a form in Access that would have a Word control (or "window") at the bottom of the...
1
1784
by: JSteil | last post by:
I have an Access 2007 form that I have already set up with an embedded PDF viewer (Foxit) and a Windows Media Player active x control. It has fields on one side that I type metadata into and the other side has the document image (think of side-by-side scanning software). I have several thousands more documents that are in their native format (.doc, .xls, .ppt, .pst, .txt etc) and would like to view them in this. I know that Edraw has what...
2
2929
by: David Anderson | last post by:
I recently began working with Access 2007, but I do have a limited experience with prior versions. I have a form with a button whose visibility I would like to make conditional on the Month value of Now(). I would like the test to be done any time the form is displayed. I have been unable to find any macros or VBA code examples showing me how to accomplish this, so I'm beginning to wonder if it can be done. In simple pseudo code, here's...
1
1965
by: jesiecraig | last post by:
Hello, I am new to Access 2007 and I am trying to import some dynamic data into WORD using an Access form. I have a "submit" button on an Access form that (drum roll please) submits several fields to the database. I would like to have the submit button also: Open a word document (I have found the code for this already) Import 5 yes/no variables into a table inside the word document. We are a school and this form is a teacher...
1
1580
by: BethLe | last post by:
In Access 2007 how to prevent subform from adding each entry to table? Adds to the size of table. thanks!
0
1289
by: Tahir Mehmood | last post by:
Hi, Thanks in advance. I am facing problem regading adding and deleting records from acess 2007 database to excel 2007 sheet.Sheet exists on system and saved at specific path.Plz help me i am in trouble. Regards, tahir
0
1438
by: Solomon Obeng | last post by:
Access 2003 enables you to print codes from print menu. But it is not so with Access 2007. How do I print the codes from an Access 2007 form?
0
9777
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11109
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10405
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7114
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5782
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.