Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Load label caption to variable (Access 2003, XP SP

    I have a complex form and want to include a description for selected values. currently I am using a label control to display a description. The form has many many drop-downs using the same yes/no/unable to determine lookup so i want to create a single code block (probably using GoSub) to set each individual selection caption, rather than writing the same logic over and over again. the problem i am having is, how to specify a particular label caption as a variable, load it with the current label and return a caption based on the selection. this is probably a matter of syntax or variable type declaration, hopefully!

    Here's my current code - should help make this question much clearer:

    Dim YN_UTD As String
    Dim lblDescriptionName As String

    YN_UTD = Me.B1.Value
    lblDescriptionName = Me.lblB1_Description.Caption

    GoTo YN_UTD_Routine

    YN_UTD_Routine:
    Select Case YN_UTD

    Case "0"
    lblDescriptionName.Caption = "No"

    Case "1"
    lblDescriptionName.Caption = "Yes"

    Case "-"
    lblDescriptionName.Caption = "UTD"

    End Select

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Load label caption to variable (Access 2003, XP SP

    I'd use a small lookup table

    <table border=1><td align=center>ID</td><td align=center>Descr</td><td align=center>0</td><td align=center>No</td><td align=center>1</td><td align=center>Yes</td><td align=center>-</td><td align=center>UTD</td></table>
    (Actually, I'd make ID a number field, but let's skip that for the moment.) Use this table as row source for the combo boxes (dropdowns), and set column count to 2. Either set the column widths to 0";1" so that the combo boxes display No, Yes or UTD, or set the column width to 1";0" and use a text box with control source =[B1].[Column](1)

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Load label caption to variable (Access 2003, X

    I've set some of the controls to display the description in the drop-down but, due to the fact that some of the descriptions are long, wanted to move the description info from a drop-down to a label below the control so as to keep the width of the drop-down small. your suggestion (the second part) does sound like it'd work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •