Forum Discussion
lucausa75
Sep 15, 2026Copper Contributor
VBA - Option Button MSAccess
Dear All,
I am using the For Each...Next loop below to check whether an option button in an MS Access form is selected.
Private Sub cmdOK_Click()
Dim Ctl As Control
DoCmd.SetWarnings False
For Each Ctl In Me.Controls
If Ctl.ControlType = acOptionButton And Ctl.Value = True Then
Select Case Ctl.Name
Case "optRegionA"
If PL_Availability("REGION") = "Y" Then
MsgBox "REGION Pricelist has been generated successfully!", vbInformation
Else
MsgBox "REGION Pricelist has been disabled!", vbCritical
End If
End Select
End If
Next Ctl
DoCmd.SetWarnings True
End SubHowever, I am encountering the error shown below.
The issue seems to be caused by this line: And Ctl.Value = True
Could you please help me resolve this?
Thanks
No RepliesBe the first to reply