Invalid Qualifier

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:
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?
 
The syntax is:

ctl.Bold = True

the Name is irrelevant since the ctl object is referring to a specific control. Name is a property of the control and so is Bold.
 
Thanks Pat - However, now I get "Object doesn't support this property or method" on the ctl.Bold = True line.
 
Not at my computer but don’t think bold is a Boolean it has different positive values depending on the type of bold - and true is -1
 
now at my computer - Bold is not a property. try

ctl.fontbold=true

or

ctl.fontweight=700
 

Users who are viewing this thread

Back
Top Bottom