Results 1 to 5 of 5
  1. #1
    dutch245 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2

    User defines # of field instances to generate a form

    Afternoon everyone!

    First off, please let me know if there is a more appropriate spot for this question, I will gladly move it if so.



    I am new to access and I am messing around in an attempt to build a database to keep track of my home brewing hobby. One of the things I would like to do is to be able to input and store recipes. I have already made a table that has fields for the various ingredients such as water, grains, and hops. Looking at various recipes, I have found that some use one kind of grains, while others use two sometimes even three. Same goes for the hops, yeasts, all the ingredients really.

    Is there a way that when a user first opens a form, a dialog box can prompt them with how many types of hops or grains they are using, then provides that many instances of each field in the report? I'm hoping there is a way, so I don't have to make separate forms for beers that have 1 grain versus 2, etc.

    If my question isn't clear, please let me know and I will attempt to reiterate.

    Thanks!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have already made a table that has fields for the various ingredients such as water, grains, and hops.
    This structure is not normalized; you should read up on normalization.

    I would start out with these tables:
    Code:
    tblRecipes
    ----------------
    RecipeID_PK     Autonumber
    Recipe_Desc     Text
    
    tblRecipeDetails
    ---------------
    RecipeDetailID_PK Autonumber
    RecipeID_FK         Long - link to tblRecipes
    Ingredient_FK      Long - link to tblIngredients 
    Amount              Single  
    Measure_FK        Long - link to tblMeasures
    
    tblIngredients
    --------------
    IngredientID_PK   Autonumber
    Ingredient_Desc   Text  (Hops, Water, Sugar, ...)
    
    tblMeasures
    -------------
    MeasureID_PK   Autonumber
    Measure_Desc  Text  (Cup, tblspn, teaspoon, Gram, lb, ...)

    There is a Recipe model at
    http://databaseanswers.com/data_models/index.htm
    The link wasn't working, but I sent an email, asking for the link to be fixed.

    Search to forum for "normalization" (and Google). Very Important to understand.

  3. #3
    dutch245 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2
    Here's how my data is broken down, I coulda sworn this was normalized hahaha

    Click image for larger version. 

Name:	0rFJq.png 
Views:	5 
Size:	51.0 KB 
ID:	9775

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Any time you see data as field names (see red circles), the structure is not normalized - should try to be in 3NF.

    (BTW, you shouldn't use dashes or spaces in field names. If you wanted to start using SQL Server or SQL Server Express, it would bomb big time. Dashes and spaces are not allowed in SQL Server names.)


    Also, as far as I can tell, you don't have any linking (PK - FK) fields

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I agree the data structure does not appear normalized. Will each table have unique record per recipe and each recipe will always have one and only one record in every table? If yes, then these tables are one-to-one relationship and is essentially a single 'flat file' and could be one table of 45 fields.

    There are definitely no pk/fk fields defined.

    It is a balancing act between normalization and ease of data entry/output.
    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.

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

Similar Threads

  1. Replies: 8
    Last Post: 03-16-2012, 01:07 PM
  2. Replies: 2
    Last Post: 03-06-2012, 07:20 PM
  3. Replies: 2
    Last Post: 08-17-2011, 06:55 AM
  4. Replies: 2
    Last Post: 04-12-2011, 08:33 PM
  5. Generate Multiple Queries per Field value
    By dssrun in forum Programming
    Replies: 1
    Last Post: 02-26-2011, 12:12 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