Label Caption In Data Sheet

Safari

Member
Local time
Today, 01:52
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
 
on Load Event of the datasheet subform:

private sub form_load()
Me!theFieldName.Controls(0).Caption = "Item Name"
end sub
 
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: 191
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?
 
it will not work in 2010.
 
try to move your code (post#1) to the Load Event of the subform (not on the Open event).
 
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
 
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.
 
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"
 
post #12 will also work with a2010.
 
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

Back
Top Bottom