Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009
    Posts
    21

    Unanswered: Problem selecting records for subform

    This should be a simple thing to do, but I am banging my head against the wall.

    I have a table that stores Patient names and IDs (tblPatientID) and another that stored basic demographic information (tblPatientData). I need to allow users to select a record from tblPatientData by selecting the Patient name from a Drop Down. These tables have a one-to-one relationship on PatientID -- a numeric field included in both tables.

    I currently have a form using tblPatientID as the data source - this form has a combo box allowing the user to select the name; however, the control is bound to the Patient ID. There is a subform for the tblPatientData data. The forms have the parent and child links set to PatientID. Selecting a patient from the combo box on the main form, does display the proper data in the subform, however, when I try to close the form, I get an error that "Changes are not successful because they would create duplicate values in the index, primary key or relationship"

    Any advice? Should I have this set up a totally different way? Am I making this a lot more difficult than it is... Thanks!

  2. #2
    Join Date
    Jun 2009
    Posts
    21
    ok - here I am responding to my own post... instead of doing a form/subform - should I just be creating a query that includes both tables and then using a control to create a filter?

    Sorry... just got this big Access project dumped on me and it's been about a decade since I've used Access -- I feel like I've forgotten EVERYTHING! Any nudges in the right direction are greatly appreciated!

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Sounds like you just need to unbind the control that you are using to find patients.

    As for whether you use a main / subform or not, I think that's up to you, however, I would personally only bother with main/subforms when there is a 1:M relationship between the tables.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Jun 2009
    Posts
    21
    Thanks for the response -- and apologies for the muddled questions.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Perfectly acceptable... it can be quite daunting when a project is dropped in your lap as you said!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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