Results 1 to 3 of 3
  1. #1
    ramindya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    20

    DLookup and combobox ( Selecting value based on yes/no )

    I have a table named tblMain and the schema is: ( MRN is Primary key )

    tblMAIN
    MRN STUDY1ELIGIBLE STUDY2ELIGIBLE STUDY3ELIGIBLE ..... upto STUDY30ELIGIBLE

    Sample data for the table is: ( For simplicity I reduced to 3 studies actually there are 30 more studies )
    MRN STUDY1ELIGIBLE STUDY2ELIGIBLE STUDY3ELIGIBLE
    1234 1 0 1
    4567 0 1 1

    Where Studyeligible means patient eligible for studies. This table/patient data is shown in the main page as dashboard for each patient.
    For example, main dashboard (formname is Mainform) will show MRN : 1234 STUDY1ELIGIBLE: 1 STUDY2ELIGIBLE: 0 STUDY3ELIGIBLE : 1 and there is a button to open another form
    named ( Scheduleform ) and behind the form is a table name tblSchedule whose schema is:

    tblSchedule: ( ID is Primaykey and autonumber datatype)
    ID MRN STUDYNAME SCHEDULEDATE



    The relationship between tblMain and tblSchedule is ( One to Many ) coz a patient can enroll in any number of studies.

    Question: I want to have a combo box for the Studyname field in Scheduleform which populates the Studynames based on the previous selection which I have enrolled (criteria is StudyXELIGIBLE = 1 )
    in the tblMain.How to populate the combobox values with those studynames ?

    For example: on opening the Scheduleform for MRN 1234 the combobox should show only STUDY1ELIGIBLE and STUDY2ELIGIBLE and select one of them and save it in the Studyname field of Studyname of tblSchedule.

    Thanks for your kind help!

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536

  3. #3
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It would take a LOT of programming to do what you want because you do not have a normalized structure as evidenced by the repeating field names: "STUDY1ELIGIBLE STUDY2ELIGIBLE STUDY3ELIGIBLE ..... up to STUDY30ELIGIBLE".

    This is described as "Committing spreadsheet". The table is "short and fat" instead of being "tall and skinny". You should have a table for patients, a table for studies and a junction table linking patients to studies; each patient can be in many studies and each study can have many patients.

    I worked on a database for scoring Karate tournaments (a hobby). I spent months trying to get it to work right. The table had Score1, Score2, Score3,..., Score5. It was such a struggle to get anything done I finally asked for help from a programmer friend that worked on mainframe databases at a bank. After looking at it for all of 2 minutes, I was told straight to my face "Can't help you. It is a bad design. Fix it, then come back." All my months effort for nothing.....except I got a good lesson on normalization.

    Sooo.... The first thing you need to do is normalize your structure.

    There are lots of sites to help with normalization. Here is one by Crystal:
    http://www.accessmvp.com/Strive4Peace/

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

Similar Threads

  1. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  2. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  3. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  4. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  5. Selecting text - ComboBox
    By Numbat in forum Programming
    Replies: 2
    Last Post: 06-05-2006, 05:42 PM

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