Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-27-2021, 02:37 AM
JamesWood JamesWood is offline At least one checkbox ticked Windows 10 At least one checkbox ticked Office 2019
Advanced Beginner
At least one checkbox ticked
 
Join Date: Nov 2020
Posts: 37
JamesWood is on a distinguished road
Question At least one checkbox ticked

Hi guys




I'm trying to write a code that ensures at least one checkbox is ticked on a form. Any idea why it's not working?


Code:
Dim oCtr As Control
For Each oCtr In Me.Controls
  If TypeName(oCtr) = "CheckBox" And oCtr.Value = True Then
    'CODE HERE
  Else
    MsgBox "You must tick at least one."
    Exit Sub
  End If
Next



Thanks a lot!
James

Last edited by macropod; 04-27-2021 at 03:27 AM. Reason: Added code tags & formatting
Reply With Quote
 

Tags
checkbox



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox - toggle hide/unhide other checkbox - XMLMapping GErl Word VBA 9 11-19-2020 03:15 PM
Table cell auto-shading when checkbox ticked. markt Word VBA 2 08-05-2020 06:13 AM
Table cell auto-shading when checkbox ticked. markt Word 2 07-10-2020 08:53 AM
At least one checkbox ticked One Content Control Checkbox checks another Content Control Checkbox DEsh Word VBA 2 10-06-2017 08:23 PM
At least one checkbox ticked Show Userform when Content Control CheckBox ticked derajlance Word VBA 1 05-13-2016 01:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft