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

    Lookup box + Query


    Hey all,

    I have a table, tblPtMeds, with an "Rx_Medication" field. The field is a combo box that serves to lookup list values from another table, tblLstMeds. There are actually 3 columns in the lookup table (tblLstMeds) that include columns for Generic Name, Brand Name, and Drug Class. If selected, only the Generic Name will be passed to the Rx_Medication field, though. See screenshot for entries from tblPtMeds and tblLstMeds.

    Click image for larger version. 

Name:	ssMedComboBox.PNG 
Views:	11 
Size:	17.3 KB 
ID:	34324 Click image for larger version. 

Name:	ssRx_Medication.PNG 
Views:	10 
Size:	6.2 KB 
ID:	34321
    (above left is the Combo box from tblPtMeds and above right is once the values have been selected)
    Click image for larger version. 

Name:	ssMedList.PNG 
Views:	10 
Size:	27.0 KB 
ID:	34322
    (above is from tblLstMeds)

    This box will allow users to enter Generic Names of medications in the tblPtMeds via a drop-down which contains common medications prescribed (~350 records). I also want users to be able to free type in responses to the Rx_Medication field in case the medication isn't listed in the drop-down. Everything is working as desired up to this point.

    The problem that I'm having is when I try to query the Rx_Medication (Generic) field. I'd like to show all records (selected via combo box or free typed) for this field, and show the Brand Name if it was selected via the combo box. I'm pretty sure I need to use the "Join" functionality but my SQL is quite rusty so I'm not 100% sure about that. Using the wizard, I can return records from tblPtMeds where there are matching values in tblLstMeds but I'm missing the records without matching values. Essentially the records that have been free-typed are not showing up. See screenshot.

    Click image for larger version. 

Name:	ssPrevMedQuery.PNG 
Views:	10 
Size:	7.0 KB 
ID:	34323
    (above is the query I created - notice GettemBetter is missing from the query)

    Any help would be greatly appreciated.

    Thanks!

    Jon

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Double or right click on the join line to edit it. The appropriate choice should be apparent. In SQL, that will change the INNER join to LEFT or RIGHT as appropriate.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jondavidf is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    57
    Perfect. Thank you!

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 03-17-2016, 07:16 AM
  2. Lookup values not appearing in Lookup field?
    By dominover in forum Access
    Replies: 4
    Last Post: 03-05-2016, 05:01 PM
  3. Replies: 4
    Last Post: 07-28-2015, 10:14 AM
  4. Replies: 3
    Last Post: 05-08-2015, 11:08 AM
  5. Replies: 5
    Last Post: 11-24-2014, 02:19 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