Results 1 to 3 of 3
  1. #1
    jondavidf is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    57

    Combo Box to select records

    Hey all,

    I'm trying to use a combo box in a form that can be used to select values from a lookup table, which select or add a new record from another table based off that value. I thought it would be pretty straight forward but it's been a while since I've created a database and am lost on this one.

    The details:



    The table, tblStudyID, Study_ID field serves as a lookup table/values for tblPtMain, Study_ID field. The tblStudyID has just the one field, Study_ID, which is populated with records 00001 - 00999. I'd like to have a combo box where I can select any of the populated values from tblStudyID, e.g. 00002, and return the associated record from tblPtMain. If Study_ID 00002 doesn't exist in tblPtMain then a record is created if values are entered in any of the other fields on the form. Please see attached screenshots. FYI, Study_ID is my combo box in the screenshots. Sorry if that didn't make sense.

    Hope that makes sense and thanks for all the help

    Click image for larger version. 

Name:	frmHelp.PNG 
Views:	16 
Size:	180.4 KB 
ID:	33980
    Attached Thumbnails Attached Thumbnails frmHelp.PNG  

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Don't see point of having Study_ID at all. How will users know what Study_ID to look for?

    But to continue on...
    Can there be more than one record in tblPtMain for a given Study_ID?

    This is a classic Mainform/Subform situation.
    Create a form with tblStudyID as the recordsource. Create the combobox and get it working to select the Study_ID.
    Then in design view, drag tblPtMain onto the form.
    Then in the subform control properties, set both child and parent linking fields to Study_ID.
    Also set the subform default view property to single form (or datasheet if there can be more than one subform record for the Study_ID).
    Last edited by davegri; 05-12-2018 at 12:13 PM. Reason: emphasize word "control"

  3. #3
    jondavidf is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    57
    The Study_ID is used in the database instead of patient's name (including name would require special handling of the database since it would contain protected health information). The personnel doing data entry will have a hard copy sheet that link's Study_ID to patient name.

    The Mainform/Subform technique worked great, too. After using a little Google to determine how to display the subform in form view and open to a blank (new) record the form is pretty much finished, just going to clean it up a little and add some navigation buttons to open other forms.

    Thanks for all the help!!

    Click image for larger version. 

Name:	frmStudy_ID.PNG 
Views:	14 
Size:	11.1 KB 
ID:	33987

Please reply to this thread with any new information or opinions.

Similar Threads

  1. using combo box to select records
    By snorbs in forum Programming
    Replies: 4
    Last Post: 05-19-2017, 07:53 AM
  2. Replies: 3
    Last Post: 08-31-2014, 01:38 AM
  3. Replies: 3
    Last Post: 06-09-2013, 05:35 PM
  4. Replies: 4
    Last Post: 10-18-2010, 09:44 PM
  5. Replies: 47
    Last Post: 06-17-2010, 03:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums