Label Caption In Data Sheet (1 Viewer)

Safari

Member
Local time
Today, 05:28
Joined
Jun 14, 2021
Messages
95
I HAVE DATASHEET AS SUBFORM .. I WANT TO CHANGE LABEL CAPTION ON OPEN EVENT
I USED THIS CODE :

ME.LABEL1.CAPTION="iTEM NAME"

BUT NOT WORKING

WHATS THE PROBLEM ?

THANKS
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
on Load Event of the datasheet subform:

private sub form_load()
Me!theFieldName.Controls(0).Caption = "Item Name"
end sub
 

Safari

Member
Local time
Today, 05:28
Joined
Jun 14, 2021
Messages
95
on Load Event of the datasheet subform:

private sub form_load()
Me!theFieldName.Controls(0).Caption = "Item Name"
end sub
still not working
 

Attachments

  • Untitled.png
    Untitled.png
    2.5 KB · Views: 143

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
what version of Access do you have?
is the code you showed from the Subform's Load event?
did you check the Name of the Textbox of the subform?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
it will not work in 2010.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
try to move your code (post#1) to the Load Event of the subform (not on the Open event).
 

Safari

Member
Local time
Today, 05:28
Joined
Jun 14, 2021
Messages
95
some one inform me that :

'Create child label control for text box.
Set ctlLabel = CreateControl(frm.Name, acLabel, , ctlText.Name, _
"NewLabel", intLabelX, intLabelY)


but i cant understated it
can you explain it
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
some one inform me that :
if you already have the Label on the datasheet and only what to change the Caption, you do not need to create a Label control.
 

GK in the UK

Registered User.
Local time
Today, 04:28
Joined
Dec 20, 2017
Messages
274
Do you mean you want to change the datasheet column headings?

This works for me (A2016) where text2 is a datasheet textbox. No labels on the form just the text boxes.

Me.Text2.Properties("DatasheetCaption") = "SomeText"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:28
Joined
May 7, 2009
Messages
19,229
post #12 will also work with a2010.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:28
Joined
Feb 19, 2002
Messages
43,233
There really is no benefit to creating a form that is bound to completely different data. There would be no way to make rational validation code. Just bind the subform control to a non-updateable query. If we had any idea what business problem you were trying to solve, we might be able to offer better advice.
 

Users who are viewing this thread

Top Bottom