Re: Making label caption = table field description

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I just thought it would be easier to rename the labels captions rather than
manually doing it since the field name are cryptic (come from a mainframe)
and I entered the descriptions in the tableview so I would know what they
are.

Is that senseable?

Also when I out in this syntax I get an error that "Object doesn't support
this property or method."

Thanks.

"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:%23Xf0yZ4hFHA.500@xxxxxxxxxxxxxxxxxxxxxxx
> It is the Caption of the label you need to set:
> c.Controls(0).Caption = c.StatusBarText
>
> Not sure why you are renaming all the controls.
> That would need to be in design view, I suspect.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "SAC" <sac@xxxxxxx> wrote in message
> news:uaMn%2393hFHA.3568@xxxxxxxxxxxxxxxxxxxxxxx
> > OH! That it will work!
> >
> > Sorry I don't quite know the syntax. Here's a routine for naming
> > conventions I attempted to modify but I'm don't know the syntax:
> >
> > Public Function LabelNaming(objForm As Form) As String
> > 'To use this function, open your form in design mode _
> > and call this function from the VBA immediate window, _
> > supplying the form name as input. Like this:
> >
> > 'NamingConventions Forms![FormName]
> >
> > Dim c As Control
> > Dim strNConv As String
> > Dim intCount As Integer
> >
> > With objForm
> > For Each c In objForm.Controls
> > Select Case c.ControlType
> > Case acTextBox
> > strNConv = "txt"
> > Case acComboBox
> > strNConv = "cbo"
> > Case acListBox
> > strNConv = "lst"
> > Case acCommandButton
> > strNConv = "cmd"
> > Case acImage
> > strNConv = "img"
> > Case acOptionGroup
> > strNConv = "opt"
> > Case 108
> > strNConv = "ole"
> > Case acCheckBox
> > strNConv = "chk"
> > Case acToggleButton
> > strNConv = "tgl"
> > Case 123
> > strNConv = "tab"
> > End Select
> >
> > If Not c.Name Like strNConv & "*" Then
> >
> > c.Name = strNConv & c.Name
> >
> >
> > '****************************************
> > ' Is this the correct syntax:
> > '****************************************
> >
> >
> > c.Controls(0).Name = c.StatusBarText
> >
> >
> > intCount = intCount + 1
> > End If
> > Next
> > End With
> >
> > MsgBox ("Renamed " & intCount & " controls to comply with " & _
> > "naming conventions and set respective labels to the
statusbartext
> > property.")
> > End Function
> >
> >
> >
> > "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
> > news:uZIAFx2hFHA.2152@xxxxxxxxxxxxxxxxxxxxxxx
> >> I'm not clear when you are trying to do this. Perhaps in the Load event
> >> of
> >> the form, you would loop through the Controls collection of the form,
> >> looking at the ControlType or testing if it has a StatusBarText, and
then
> >> assigning to the Caption of the attached label. The attached lable will
> >> be
> >> Controls(0) of the text box.
> >>
> >>
> >> "SAC" <sac@xxxxxxx> wrote in message
> >> news:uRgxzI2hFHA.3692@xxxxxxxxxxxxxxxxxxxxxxx
> >> > Thanks.
> >> >
> >> > From this I would know how to set properties for the text boxes and
> > other
> >> > data entry control, but how would I set the caption property of a
> >> > corresponding label?
> >> >
> >> > Thanks, again.
> >> >
> >> > I really appreciate the help.
> >> >
> >> >
> >> > "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
> >> > news:uQn2W91hFHA.4016@xxxxxxxxxxxxxxxxxxxxxxx
> >> >> This link demonstrates how to loop through the Fields of a TableDef,
> >> > getting
> >> >> the Description property of each field that has one:
> >> >> http://allenbrowne.com/func-06.html
> >> >>
> >> >> If the table fields have descriptions at the time you create your
> >> >> form,
> >> >> Access automatically copies the description into the StatusBarText
> >> > property
> >> >> of each control, so perhaps you could also read them from there?
> >> >>
> >> >> "SAC" <sac@xxxxxxx> wrote in message
> >> >> news:upbMPx1hFHA.1480@xxxxxxxxxxxxxxxxxxxxxxx
> >> >> >I have several tables where I have entered the descriptions of each
> >> > field.
> >> >> >
> >> >> > Can I write a routine for a bound form that would place a label
> >> >> > whose
> >> >> > caption = the field's description and a texbox whose data source =
> > the
> >> >> > field?
>
>


.



Relevant Pages

  • Re: Unbound control caption
    ... unbound controls (2 text boxes, 3 combo boxes) for use as a search ... I want to be able to add a caption to these boxes so I didn't ... Labels, in general, work great for unbound controls on search forms. ... property change) and show or hide the label dynamically. ...
    (comp.databases.ms-access)
  • Re: Actual VB question!
    ... I have a problem where the text or caption line up near the top ... of the textbox or label. ... There is a lot of neat stuff in the Format menu. ... It can also be customized to add more of the formatting controls that aren't present. ...
    (comp.lang.basic.visual.misc)
  • Re: Unbound control caption
    ... unbound controls (2 text boxes, 3 combo boxes) for use as a search ... I want to be able to add a caption to these boxes so I didn't ... Are you talking about controls on a subform, ... property change) and show or hide the label dynamically. ...
    (comp.databases.ms-access)
  • Re: Making label caption = table field description
    ... Not sure why you are renaming all the controls. ... > Dim strNConv As String ... >> assigning to the Caption of the attached label. ...
    (microsoft.public.access.formscoding)
  • RE: Dynamic control creation.
    ... of a check box that the value of the label is updated), ... javascript on the checkboxes to update the value of this label, ... When i looked in the source code i found out that the server side label ... controls) recreates the 3 checkboxes. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)