below code is working good but while reset control like textbox and combobox its occur in below line.
Me.Text2.Text = Mid$(s, 1, Len(s) - 1)
actually all the checkboxes are disable while runtime.
when user select 1 to 7 from combobox then only 1 to 7 checkboxes are enable to select block no from 15 checkboxes.
if user select wrong block no and need to reset while entry so we have put one button to reset combobox and textbox.
error is
runtime error '5' invalid procedure call or argument
Sub cBoxSelection()
Dim m As Integer
m = Me.Controls.Count
ReDim TheArray(m) As String 'Max size the array will be
Dim cBoxes As Object, Index As Integer
Index = 0
For Each cBoxes In Me.Controls
'Debug.Print TypeName(cBoxes), cBoxes.Value
If TypeName(cBoxes) = "CheckBox" Then
If cBoxes.Value = 1 Then
TheArray(Index) = cBoxes.Caption
Index = Index + 1
End If
End If
Next
ReDim Preserve TheArray(Index) 'Get rid of the empty spaces
'SortArray TheArray
Dim s As String
s = Join(TheArray, ",")
Me.Text2.Text = Mid$(s, 1, Len(s) - 1) ' Replaces last comma.
End Sub