TheSearcher
Registered User.
- Local time
- Yesterday, 23:38
- Joined
- Jul 21, 2011
- Messages
- 342
I want to make certain command button captions to be in bold print when my form is opened. To determine which command buttons should be bold I open a recordset and run the following code:
The msgbox returns the correct command button name. However, the code errors out at the ctl.Name.Bold = True line with an Invalid qualifier compilation error. The name of the command button, in this case, is cmd_ADT which conforms to the proper naming conventions. Does anyone know what I'm doing wrong?
Code:
If rs.RecordCount > 0 Then
Do Until rs.EOF
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "category" Then
If ctl.Caption = rs("Category") Then
MsgBox ctl.Name
'ctl.Name.Bold = True
End If
End If
Next
rs.MoveNext
Loop
End If
The msgbox returns the correct command button name. However, the code errors out at the ctl.Name.Bold = True line with an Invalid qualifier compilation error. The name of the command button, in this case, is cmd_ADT which conforms to the proper naming conventions. Does anyone know what I'm doing wrong?