Results 1 to 10 of 10
  1. #1
    FredoC is offline Novice
    Windows 11 Access 2016
    Join Date
    Oct 2025
    Posts
    2

    Variable number of entries in a field

    Hello, I am trying to make a nice database for my board game collection, with the name, publisher, year published, # of players etc... One of the entry will be the designer. Many games have just one, but some have 2, or more. I could use a Multivalued field, but I read it is discouraged by database normalization principles. From what I read, having a subform with many-to-many relationships would be the way to go, but I am not exactly sure about how to implement in my case, even though I feel like it is a fairly simple (or not too uncommon) situation. Anyone can help?



    Frederic

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Yes, multi-value field is not preferred by experienced programmers but if you fully understand its drawbacks and how to deal with, it might be appropriate for your needs. Otherwise, have a related table where each selected developer is a record (this is actually what MVF does but table is hidden). Many-to-many actually involves 3 tables. Form arrangement would be main form bound to Games table and a subform bound to GameDevelopers table with a combobox for selection of developer from Developers table.
    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.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Office 365
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    A multi value field still has the many to many table, it’s just that it is hidden and limited in structure- basically just containing the PK of the parent and the PK of the child.

    On many occasions you want more than that - for example the date a relationship started or ended (employer/employee, customer/contact), or perhaps a quantity or type of relationship such as job role.

  5. #5
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    566
    Hello, I am trying to make a nice database for my board game collection, with the name, publisher, year published, # of players etc... One of the entry will be the designer.

    BoardGame(GameID autonumber PRIMARY KEY, Game Title TEXT(25) NOT NULL, Publisher TEXT(50) NOT NULL, YearPublished INT NOT NULL)

    Designer(DesignerID
    autonumber PRIMARY KEY, FirstName TEXT(25) NOT NULL, LastName TEXT(25) NOT NULL)

    GameDesigner(DesignerID INT NOT NULL, GameID INT NOT NULL);

    It's actually easier to do this in T-SQL because you can name and specify the foreign keys more cleanly.

    CREATE TABLE GameDesigner (
    DesignerID INT,
    GameID INT,
    CONSTRAINT pkGameDesigner PRIMARY KEY (DesignerID, GameID),
    fkDesigner FOREIGN KEY DesignerID REFERENCES Designer(DesignerID),
    fkGame FOREIGN KEY GameID REFERENCES Game(GameID)
    );



  6. #6
    Join Date
    Sep 2025
    Location
    Newport, Shropshire, UK
    Posts
    25
    The attached file is really designed to illustrate the use of correlated combo boxes, but it happens to include a form in which a subform based on a table which models a many to many relationship type is embedded. As you'll see the subform allows multiple employers per contact to be entered by selecting the employers in a combo box. The combo box is bound to the EmployerID foreign key column, but is set up so that an employer can be selected by name. You would do the same for game designers.
    Attached Files Attached Files

  7. #7
    FredoC is offline Novice
    Windows 11 Access 2016
    Join Date
    Oct 2025
    Posts
    2
    Thank you all for the responses. I realize I might not be knowledgeable enough about Access to implement your tips into what I am trying to do. See the form I had done for my coin collection, where I would enter the data for any new coin added. My game collection database would be similar, but keeping that coin form as an example, let's say some coins may have more than one Reverse artist (most times 1, but sometimes 2, and some others 3). So the field would have a variable number of values (names), and I would want to be able to enter any numbers of artist for that one label in the form, while keeping the database integrity where I could do a query to search for any coin from that artist, no matter if he/she contributed alone or with others. Any help? Do I make sense?Click image for larger version. 

Name:	Coin Form.jpg 
Views:	9 
Size:	100.0 KB 
ID:	53333

  8. #8
    Join Date
    Apr 2017
    Posts
    1,793
    Let's assume you'd have a situation where some coins may have several different images on reverse side:
    Then you'd need the coins table like
    tCoins: CoinID, CoinName, ...;
    but without the field for reverse side,
    and the table like
    tCoinReverses: CoinRevID, CoinID, RevImage.

    Then you create a continuous form based on table of coin reverses, which always displays a single image - but you can select any of them (from scrollbar, or from move buttons on footer). The form contains controls for CoinRevID and CoinID too, but their widths are set to 0, and they aren't visible. And you may add a button on header of form to add a new reverse too.

    On your coins form, instead of field for displaying the reverse image, you place this additional form as subform (Simply dragging the continuous form into main form in design mode - the main form and subform must be linked by CoinID).

    When you select a new coin in main form, the first of reverses for this coin is displayed in subform. You can select any of other reverses registered for this coin to be displayed instead, when they exist. Or you can add a new image for new reverse into subform, which will automatically linked with current coin activated in main form. The number of currently registered reverses for currently active coin is displayed at footer of subform

  9. #9
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    437
    you create a separate table for ReverseArtists (see demo).
    open MainFormCoins and enter Info on main form and on the sub-form.
    Attached Files Attached Files

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    I would have the artists all in one table, but a junction table with a field to indicate whether Obverse or Reverse.
    Then with your form as it is, make the controls combos, unless you wanted to see more than one at a time, then perhaps a listbox. Both could auto expand when they get the focus?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 10
    Last Post: 08-02-2021, 08:17 AM
  2. Replies: 3
    Last Post: 09-26-2017, 11:19 PM
  3. Replies: 2
    Last Post: 05-07-2015, 02:55 PM
  4. Using BETWEEN in variable entries
    By jtmurphy in forum Queries
    Replies: 3
    Last Post: 07-25-2014, 10:46 AM
  5. Replies: 11
    Last Post: 03-13-2014, 09:54 AM

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