How does Access 'relate' a control and a label?

tfurnivall

Registered User.
Local time
Yesterday, 21:22
Joined
Apr 19, 2012
Messages
81
I'm getting waaaay to deep into Access' internals, but I have a nagging question - how does Access relate a label to a control?

We can delete the label, and then re-'attach' it, but there seems to be no visible property that retains this information - in either the label or the control (only done the detailed comparison for text box so far ;-)

I'd appreciate any thoughts or knowledge.

Tony

PS The reason for this is to be able to export enough data to recreate an Access form in html, and I need a label value if it exists. (And for most controls, of course, it does!)
 
Someone else can probably point straight to it, but I would create a bit of VBA which iterates through the control to debug.print the property name and value.

Comparing the results you get from a linked control and unlinked control should point you in the right direction
 
Thanks, CJ I've already done that, and there's absolutely no indication (from simply listing out Control Properties Name/Value pairs) that provides a clue.

(Of course, one zero can have multiple meanings, but nothing that I could find leapt out and said "Ta!Da!")

Tony
 
I've done some research, it's something I might want to do someday!

Anyway found it - it is not in the properties section, it is in the controls section - it will be the only control so

Debug.Print myControl.Controls(0).Name

will give you the name of the control

myControl.Controls(0).forecolor=vbred

will change the forecolor to red etc.

I haven't experimented much so to create a link you probably need to add the label to the controls collection. Be interesting to see if you can add two labels!
 
I haven't experimented much so to create a link you probably need to add the label to the controls collection.

Yes this is correct.
Be interesting to see if you can add two labels!
I had the same idea when I discoved this collection and tried adding more than one label. It doesn't allow it.
 

Users who are viewing this thread

Back
Top Bottom