Trying to set the color of the detail section of a subform using vba

rogerdjr
rogerdjr used Ask the Experts™
on
Trying to set the color of the detail section of a subform using this code:

            Forms![0_masterdatafrm]![80_ConstrMtgWkgFrm]![GroupMeetingAgendaBtn].Caption = "Standard Agenda"

gives me run-time error 438 "object doesn't support this property or method


When I toggle a button on the subform the color of the detail section of the subform changes okay using this code:

             Me.Detail.BackColor = 16777215

I'm sure its a simple syntax issue but I'm stumped
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
Try specifying the Form object:

Forms![0_masterdatafrm]![80_ConstrMtgWkgFrm].Form![GroupMeetingAgendaBtn].Caption = "Standard Agenda"

Open in new window

Also, 80_ConstrMtgWkgFrm  must be the name of the subform control, which may differ from the form it holds.

Author

Commented:
I knew it was simple

Fixed code changes detail color

Forms![0_masterdatafrm]![80_ConstrMtgWkgFrm].Form.Detail.BackColor = 16625915

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial