BASE: how change label in Label field?

I found how in Label field in form, for example, change visibility

Dim ocControl As Object
Set ocControl = Forms("myForm").Controls("myControl")
ocControl.Visible = False

Work correct. But, I can’t find how change label in Label field.
Can someone help me?

Hello,

ocControl.Label = "SOME_TEXT_HERE"

Edit:

Here is the complete working code used in my test:

Sub ChangeLabel
    Dim ocControl As Object
    Dim oForm As Object
    oForm = ThisComponent.Drawpage.Forms.getByName("YOUR_INTERNAL_FORM_NAME")
    ocControl = oForm.getByName("YOUR_LABEL_CONTROL_NAME")
    ocControl.Label = "Hello!!!"
End Sub

Tnx. Sounds simple and very logical, but it doesn’t work.

BASIC runtime error.
Property or method not found: Label.

I am very grateful for your answer! Thank you for help. It’s work!

I don’t understand why properties like visible and enable works with one method, but not with another, and property label work vice versa method. By some of my logic it makes no sense. But I’m pretty beginner in programming :slight_smile:

I would like to understand. If the answer is too complex, please just refer me to the information on the net.

It appears you are using Access2Base. This is an interface to the Uno API written to attract those using Access in the past. It may or may not contain all interfaces to the API - I do not know. I avoid it. When coming to LO Base years ago, decided to use the API. It can be a struggle especially at first but pays off in the long run.

For more information on Base and macros, see this post → [To learn LibreOffice Base are there introductions or tutorials?](link text)

Would suspect you have → Access2Base

I am really very grateful to you!
Just few sentences and instructions, but very useful for me!
General, for me is very hard find solutions when I stuck in some problem. When I search the net looking for an answer for my problems, I’m losing a lot of time! :frowning: So, once again, thank you very much!
Indeed, I began to use Access2Base because long time ago I used and programmed in Access. It was a natural sequence use Acces2Base. But I will follow your advice :slight_smile: