Results 1 to 3 of 3
  1. #1
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25

    Populating listbox on a form using multiple fields.

    Hey guys,

    Beginner here.

    I have a table called Prod_DB, in this table i have a field called "Country" which stores country names, and then i have many other fields for years, ie: a field called "2009" which stores values (production in Kilograms) relating to the country in field "Country" and another field "2010" and field "2011" and so on.

    So basically its a table which stores production numbers of fertilizer for certain countries by year.

    I have a form "form1" which has a combo box used to select county names and then populate a list box based on the selection made.

    now what i want to do and cannot figure out how to do it is how to create a similar combo for the years, since the values are stored in many fields.

    to simplify the issue, i want the user to select a country (or countries) and select the desired year (or years), from the table Prod_DB, and then display a report containing the desired information.

    I have attached the sample database.

    thank you in advance.Production.zip

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    This will be a little (to very) difficult because your table structure is not normalized. You are "Committing Spreadsheet" .

    This should help: http://www.google.com/#hl=en&tbo=d&s...w=1280&bih=882

    I'll look at your dB tonight when I have use of A2K7..

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    ssanfu is absolutely right! Your Table is not really a Table at all, but is, in fact, simply a spreadsheet! At the least, the Fields in this Table should be

    • Country_ID
    • Country
    • ProductionYear
    • FertilizerProductionAmount

    Some would even split this up into two Tables, with Country Table having

    • Country_ID
    • Country


    and a Production Table having

    • Country_ID
    • ProductionYear
    • FertilizerProductionAmount


    Then you'd present the data using a Main Form (Country Table) and a Subform (Production Table) scenario, with the Form/Subform being linked on the Country_ID Field for data entry/viewing.

    Linq ;0)>

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

Similar Threads

  1. Replies: 8
    Last Post: 08-02-2012, 10:50 AM
  2. Form Fields Not Populating
    By JeffG3209 in forum Forms
    Replies: 1
    Last Post: 07-21-2012, 05:27 PM
  3. Pre Populating Form Fields
    By psuedo98 in forum Forms
    Replies: 3
    Last Post: 03-20-2012, 12:51 PM
  4. Populating Form Fields From Another Form
    By JeffG3209 in forum Forms
    Replies: 1
    Last Post: 08-16-2011, 09:10 AM
  5. Populating multiple fields
    By jjcaprio in forum Programming
    Replies: 11
    Last Post: 08-16-2009, 01:51 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