Results 1 to 7 of 7
  1. #1
    HrErik is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    2

    Inline editing - many to many relation

    Hey,



    I have a database that I use for time budgeting in a school. I have a table with the activities, the teacher, number of hours in each week ond much more. The teacher field is related to a teachers table. Sometimes i have to put two ore more teachers on one activity. A simple example of the table could look like this:

    ID Activity Teacher Hours W1 Hours W2 Hours W3
    1 Math John 6 6 2
    2 Economy Adam 4 4 6
    3 Project John,Adam 12

    At the moment I use a multi valued fielt for the teacher, and that works for now. But it is a problem for me, that the only way I can populate the teacher field is by using the mouse in a combo box. I would like to be able to just enter "John,Adam" in the field, og maybe insert values from the clipboard for fast editing.

    So question 1 is:
    Is there a way of populating a multivalued field without having to use a combobox in the form?

    I've read many places, that multivalued fields is a bad solution, that can cause problems on the long term. So I've tried to use a many to many relationship instead. The database design works fine, bud the problem again is the list form. All the videos I've watched about the subject shows how to build a form with a subform. And that works fine, but again - I want to be able to simply enter the data in a field separated with a comma.

    Question 2:
    Is it possible to populate a fiels with comma saparated values i a form, and that way select values in a many to many relationship?

    Erik

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    My suggestion is... don't use multi valued fields. They are an incredibly bad idea because accessing the data in them is extremely difficult. You should properly normalize your data, you're essentially just making a flat excel file which really cuts down on the strength of using a relational database.

    i.e.

    Code:
    tblTeacher
    T_ID  T_Name ---> other teacher related fields
    1     John
    2     Adam
    
    tblActivity
    A_ID  A_Name ---> other activity specific fields
    1     Math
    2     Economy
    3     Project
    
    tblActivityTracker
    AT_ID  A_ID  A_StartDate  A_EndDate A_Hours
    1      1     1/1/2019     1/7/2019   6
    2      2     1/1/2019     1/7/2019   4
    
    
    tblActivityTrackerTeacher
    ATT_ID  AT_ID  T_ID
    1       1      1
    2       2      2
    3       3      1
    4       3      2
    Multi value fields are a menace!

  3. #3
    HrErik is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    2
    The model you describe is the database design I was planning (many to many). So my problem is how I make that look like a field with multiple values in my form, where i can edit the values fast.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Everything in the setup I described is one to many.

    if you want to be able to type something like

    john, adam, susan

    and have your database figure out which teachers those are you can parse the string at the commas then look up a teacher with those first names. However, it would break down any time you had a teacher with the same first name, then you'd have to do something like

    john f, john b, adam, susan

    where the identical first names would have to have the first letter of their last name in EVERY instance of, not just the ones where they appear together, that person.

    Personally, if you are dealing with a small number of teachers you might be able to do a multi select list box to select the teachers to add, if you have a large number of teachers (more than say 15) that becomes impractical but still doable.

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    How about the approach in this example? Pretty quick to pick the teachers, and no name ambiguity.
    MTM Schedule Events-davegri-v01.zip

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you use approach of typing CSV names, I guarantee you will enter spelling errors and this is road to insanity.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    HAH, could not agree more with june here. Allowing the great unwashed to free form enter text fields is a recipe for headaches.

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

Similar Threads

  1. Table relation
    By Nandu_7 in forum Access
    Replies: 14
    Last Post: 08-12-2016, 12:06 PM
  2. Relation between tables
    By vincentsp in forum Forms
    Replies: 8
    Last Post: 02-03-2015, 08:53 AM
  3. Inline graphics in text fields
    By JustAnElf in forum Access
    Replies: 4
    Last Post: 10-28-2013, 10:36 AM
  4. Replies: 3
    Last Post: 10-19-2013, 10:21 AM
  5. relation ship
    By sarab565 in forum Access
    Replies: 4
    Last Post: 12-02-2011, 01:53 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