Header Titles from with in VBA (1 Viewer)

Status
Not open for further replies.

GrunleStan

Registered User.
Local time
Tomorrow, 00:50
Joined
Aug 7, 2018
Messages
22
I find having to have my Property windows open and double checking tons of forms to edit a caption very tedious.
And so I was able to set the captions of a form via VBA code! Hooray !

But when I tried to do it for a Header label, the code seems to fall flat on its face :banghead:.

I have the following in the form header;

Private Sub Form_Open(Cancel As Integer)
Me.Auto_Header0 = "Staff Data View - SDC Division (Edits Disabled)"
Me.Caption = "Staff Data View - SDCD"
End Sub

The 1st line results in "Run Time Error 438 : The object doesn't support this property or method"

Am I assigning the text too early ? it is just a Label, and I have been able to do so other times.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:50
Joined
May 7, 2009
Messages
19,169
use the Caption property:

Me.Auto_Header0.Caption="Staff Data View - SDC Division (Edits Disabled)"
 

isladogs

MVP / VIP
Local time
Today, 16:50
Joined
Jan 14, 2017
Messages
18,186
If it does still error following arnel's correction, move the code to Form_Load
 
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom