Results 1 to 5 of 5
  1. #1
    mdpepper1 is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    5

    Can I use element in a field as field name in another table?

    I am an IT placement student working for a wildlife charity for one year.



    I have a table of 20 species. Each row contains some information on a single species. I want to add functionality to add a new species. That is easy.

    I have another table which is for the legislations that apply to each species. Each species is used as a field name in the legislation table and there either exists a 'Y' in its cell relevant to each legislation, or a null.

    Can I write code/create a macro or expression to add a new species to the species table, which will automatically generate a new column in the legislation table, and also to generate a new field in the 'add legislation' form?

    If this is possible, can someone give me a few pointers on how to achieve it?

    Thanks,
    David

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by mdpepper1 View Post
    I am an IT placement student working for a wildlife charity for one year.

    I have a table of 20 species. Each row contains some information on a single species. I want to add functionality to add a new species. That is easy.

    I have another table which is for the legislations that apply to each species. Each species is used as a field name in the legislation table and there either exists a 'Y' in its cell relevant to each legislation, or a null.

    Can I write code/create a macro or expression to add a new species to the species table, which will automatically generate a new column in the legislation table, and also to generate a new field in the 'add legislation' form?

    If this is possible, can someone give me a few pointers on how to achieve it?

    Thanks,
    David
    Yes, you can. There are lots of examples if you search. Having said that, this is an *extremely* bad design. Your structure is not/will not be normalized.

    After you add the new fields, what then? You will have to redesign your queries, forms & reports for each new species and/or legislation.

    Good luck.....

  3. #3
    mdpepper1 is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    5
    Quote Originally Posted by ssanfu View Post
    Yes, you can. There are lots of examples if you search. Having said that, this is an *extremely* bad design. Your structure is not/will not be normalized.

    After you add the new fields, what then? You will have to redesign your queries, forms & reports for each new species and/or legislation.

    Good luck.....
    Thank you. I am in agreement. I have decided to normalise my tables further on the back end and tackle it that way.

  4. #4
    mdpepper1 is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    5
    Ok, I have fixed my table structure. I am now having trouble with populating my form.

    I want to add a species, then have a list of check boxes of the existing pieces of legislation in the legislation table.

    Is this the process I should undertake:

    1. create form

    2. add facility to add species

    4. have a button that when there's an onclick event run a query to obtain all pieces of legislation in the legislation table

    5. use result from query to create a list of check boxes on the form

    6. add button to add the boxes that have been ticked.

    David

  5. #5
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Ok, I have fixed my table structure. I am now having trouble with populating my form.
    What is the structure now? Would you attach a PDF of the relationship window?


    5. use result from query to create a list of check boxes on the form

    6. add button to add the boxes that have been ticked.

    David
    This still sounds like you want to modify the forms/tables/reports "on-the-fly". If the structure is correct, you should never have to modify the tables/forms/reports just because you add new data; of course, if you add or delete functionality, that is a different matter.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-31-2011, 04:03 PM
  2. Replies: 3
    Last Post: 08-26-2011, 12:11 PM
  3. how to export data field to field in a table
    By farhanahmed in forum Database Design
    Replies: 1
    Last Post: 04-05-2011, 10:04 AM
  4. Replies: 5
    Last Post: 01-20-2011, 11:36 PM
  5. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM

Tags for this Thread

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