Show related fields (from different table) in form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mailing
    New Member
    • Nov 2006
    • 5

    Show related fields (from different table) in form

    Hi All,

    I have a Main form which has many different tables/Queries linked to it.
    No problem to create individual field using combo box with pull down list.
    How do I create 2 related fields in this form, ie: Person Initial, Person Name and have both automatically filled in?

    Thanks
    maili
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    First you must have your form set up to display the record you want to retrieve, i.e. you must have fields set up with the appropriate Control Sources. Then simply:

    Add a combo box to your form. The Combobox Wizard will pop up
    Select "Find a record based on the value I selected in my combobox."
    Hit Next.
    Click on the field you're searching by to move it to the right side.
    Hit Next.
    Size the column appropriately.
    Hit Next.
    Name the combobox.
    Hit Finish.

    Now you can drop the combobox down and scroll down to the item to search by, or you can start to enter the item, and the combobox will "autofill" as you type.
    Hit <Enter> and the record will be retrieved.

    Comment

    • mailing
      New Member
      • Nov 2006
      • 5

      #3
      Hi,
      Sorry I was not clear... I need to have 2 combo boxes in 2 different fields relating to
      each other.
      For example, person initial and person name: ml is maili.
      The problem is when I created 2 combo boxes on the form, they popup individually;
      how do I make them popup with the same value?

      Thanks
      maili

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Sorry, that's still not clear what you need to do here.

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Originally posted by mailing
          Hi All,

          I have a Main form which has many different tables/Queries linked to it.
          No problem to create individual field using combo box with pull down list.
          How do I create 2 related fields in this form, ie: Person Initial, Person Name and have both automatically filled in?

          Thanks
          maili
          Maili

          If your combo box has both these details in it's list then its easy; e.g. if first column (bound and hidden column) is set to an id field and second column to [Person Initial] and third column to [Person Name]. If the two textboxes are called txtPersonInitia l and txtPersonName.

          In the after update event of the combo box put the following:

          Code:
           
          Private Sub ComboboxName_AfterUpdate()
           
          Me.txtPersonInitial = Me.ComboboxName.Column(1) ' starts at 0
          Me.txtPersonName = Me.ComboboxName.Column(2)
           
          End Sub

          Comment

          Working...