View Single Post
 
Old 04-27-2021, 02:37 AM
JamesWood JamesWood is offline Windows 10 Office 2019
Advanced Beginner
 
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