Richaradthomas
New member
- Local time
- Today, 05:52
- Joined
- Jun 13, 2022
- Messages
- 1
After you change the caption of your label, use the Refresh-method of theHi,
I like to update label Captions here within a form.
However I am only able to get the control Name and not the caption of that control.
The reason I like to update all Labels in a Form as I have always something like Cont_FirstName and so on..
I like to get rid of the "Cont_" so the caption is "Firstname"
Code:Sub Test() Dim ctl As Access.Control Dim strOld As String strOld = "Cont_" Dim strNew As String strNew = "" For Each ctl In Forms!frm_Contacts ' must be open in design view If ctl.ControlType = acLabel Then Debug.Print ctl.Name Dim strLabel As String strLabel = ctl.Name dislyke.com/instagram-captions/ Debug.Print me.(ctl.Name).Caption) 'How To get this Property when not knowing the Control Name End If Next ctl End Sub
Once I am able to receiving the Caption I am able to update that Label so I was hoping someone could help please.
Would be just nice as there are many Forms and Controls so it would be a nice thing to have.
Many thanks
label to get it to repaint itself. Only then it shows its new value.
When you do not refresh the label, it is refresh when your code has
completed. As only then the events are handled by the system. So you could
use the ‘Do Events’ command, but it is much beter to just refrehs the label.
For more data search in MSDN for ‘Refresh’. It also gives you an example.