Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2004
    Location
    Mackay, Queensland, Australia
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Show all fields from Lookup (2002/2003)

    Hi there
    In my training database I have a Participants table and a Courses table which has two fields ... CourseID and CourseTitle. There is a CourseID field in the Participants table where I have used a two column lookup so the user can pick the course from a drop down list. They can see both the CourseID and the CourseTitle in the drop down and it returns the CourseID into the field. I want both the CourseID and the CourseTitle to show in the field and just can't get it happening. I know it's all there in the database and both fields show up in queries and reports, but I want the user to be able to see the CourseTitle on the form as well.
    No doubt it's really simple, but I'm not having any luck. Any help will be much appreciated.
    Thanks
    Suzanna

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

    Re: Show all fields from Lookup (2002/2003)

    I assume that you have a combo box bound to the CourseID field on your form. You can show as many fields as you like in the dropdown list of the combo box, but the text box part will only show the first column from the row source of the combo box that has non-zero width. So if you want to show both the CourseID and CourseTitle in the text box part of the combo box, you must use a little trick:
    - Create a new query based on the Courses table.
    - Add CourseID to the first column.
    - Create a calculated field in the second column:
    <code>
    Course: [CourseID] & " - " & [CourseTitle]
    </code>
    - You can replace <code>" - "</code> with whatever you prefer.
    - Save this query as (say) qryCourses.
    - Set the Row Source property of the combo box to qryCourses.
    - Make sure that the Column Count property is set to 2 and the Column Widths property to (for example) <code>0";1"</code> (this is probably already the case).

  3. #3
    Lounger
    Join Date
    Mar 2004
    Location
    Mackay, Queensland, Australia
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Show all fields from Lookup (2002/2003)

    Yes to your assumptions about the combo box Hans. Thank you SO much for the trick. I can stop tearing my hair out!
    Have a great day/night
    Suzanna

Posting Permissions

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