How to show relevant column data in Combo box?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sg2808
    New Member
    • Mar 2012
    • 91

    How to show relevant column data in Combo box?

    Hi,

    I guess this should be easy but I do not know how to solve it.

    I have two tables and its fields:

    Table [Functions]
    FunctionID - PK
    FunctionName

    Table[HLProcess]
    HLProcessID - PK
    FunctionID - FK
    HLProcessName

    The tables are linked as one to many, [Function]1:M[HLProcess]

    I have created a form for Table - [HLProcess].

    Step A - In this form, I then changed the field [FunctionID] to a combo box from text box so that I can pick up the [FunctionName] from table [Functions] and save it in the field [FunctionID] in table [HLProcess].
    For the a above, I am using the property sheet and saved the query to get the drop down for Function field.

    The problem I am facing is that I am only able to see the [FunctoinID] number in the form instead of the [FunctionName].

    Step B - So, what I then do is, delete the FunctionID field which is created during the creation of the Form. I then create a combo box (with the wizard tool on) and then able to see the [FunctionName] field in the drop down in the form.

    So, I am not sure what else I have to do in Step A itself when I am changing the text box to a combo box in the form to see the [FunctionName] in the dropdown?

    Thanks in advance.

    SG
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    So, SG, what you are trying to do ?
    What is the final goal ?

    Comment

    • sg2808
      New Member
      • Mar 2012
      • 91

      #3
      Hi Mihail,

      This is I guess is a basic way to link the two tables. A user can do this easily by selecting the [FunctionName] instead of the [FunctionID].

      As described here, the final goal in this case is to able to see the data I want to see [FunctionName] instead of the [FunctionID] in the ComboBox and thus enable the user to link the two tables using the Form easily.

      As mentioned, I am able to do this in 2 steps. I am wondering if I can do this in 1 step.

      Best regards,
      SG.

      Comment

      • Mihail
        Contributor
        • Apr 2011
        • 759

        #4
        Maybe my English is not enough to understand you.
        But...
        1) why you do not use a form (frmFunctions) and, in this form, a subform (sbfHLProcess) ?

        2) Or:
        Create 2 continous forms: frmFunctions and frmHLProcess.
        Then, from frmFunctions open frmHLProcess using a filter to show only the records from the current FunctionID.

        3) Or:
        Create a single form frmHLProcess and, in this form a combo box with row sources a query on table Functions. Then use the Filter feature.

        Maybe is other thing you don't know:
        A combo box control has a property named Columns Count. Setting this property to a number greater than 1 will allow you to see more columns.
        Also this control has a property Bound Column. Is 0 (zero) by default: that means that, when you select something in combo box, the value for combo box will become equal with what you have in the first column (the columns numbers start with zero).
        Also you can set the columns visibilities: something like this: 0;2;4 means that first column is not visible, the second column is 2cm large and the 3th is 4cm large.

        Let me know if you can use that.
        If not I'll prepare for you a database where to show you points 1) 2) and 3).

        Comment

        • sg2808
          New Member
          • Mar 2012
          • 91

          #5
          Brilliant. Many thanks Mihail for the above information. That helps.

          Comment

          Working...