Results 1 to 8 of 8
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111

    Need to reference two bound columns in Access 2007 lookup table



    down vote favorite I have a look-up table (Areas) with 3 columns. Column 1 is the section of the state the county is in, column 2 is the county abbreviation, and column 3 is county name. I have a form (DataEntry) in which I want the user to select the county name, have the county abbreviation value (column 2) get stored in the "County" field and the value in column 1 get stored in the "Section" field.


    For example, in the Northern area of Utah is Box Elder County (BE). The row of data in the look-up table looks like this: North,BE,Box Elder County. Should the user select Box Elder County, the following values would get written to the "StateLoc" table.

    Code:
    County    Section
    BE        North
    The problem is that I can only declare one bound value and I really want to bind two; the abbreviation to write to the County field and section to write its corresponding value to the Section field. Suggestions as to how to approach this?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is this what you're after?

    BaldyWeb - Autofill
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    You don't need to have two bound columns to accomplish that. You use one field bound to the boundcolumn (county), and in the afterupdate event of the combo box, you set the value of a text box that's bound to the other field (section).

    However, what you are doing is a violation of normalization. Since county uniquely determines both the county abbreviation and the section, you should have the correlation in a second table (which you already apparently do) and then join that table when you need it, rather than storing redundant data in the underlying data table. If county abbreviation is not unique, which it probably isn't, then you should have a primary key, and store that in the data, rather than the county name, section name, and county abbreviation.

  4. #4
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111
    I am not interested in storing the county name in the StateLoc table. I want the abbreviation for future Unique ID number generation if customer application was accepted. (concatenation of county ID + last assigned number + 1) County abbreviation and county name are always unique in the look-up table since we are only looking at counties in Utah. (Section is not though). The user however, does not know the county abbreviation but does know the county name. The look-up table was created solely to limit the choices and standardize the data entered.

    Quote Originally Posted by Dal Jeanis View Post
    You don't need to have two bound columns to accomplish that. You use one field bound to the boundcolumn (county), and in the afterupdate event of the combo box, you set the value of a text box that's bound to the other field (section).

    However, what you are doing is a violation of normalization. Since county uniquely determines both the county abbreviation and the section, you should have the correlation in a second table (which you already apparently do) and then join that table when you need it, rather than storing redundant data in the underlying data table. If county abbreviation is not unique, which it probably isn't, then you should have a primary key, and store that in the data, rather than the county name, section name, and county abbreviation.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Was post 2 not appropriate?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    I'm missing something. What's the StateLoc table? Is that where the user's individual records are stored?

    Your Areas table already has the the county abbreviation and county name and section, right? And the County Abbreviation is unique, right? So if you store the county abbreviation on the iundividual records, you don't need to store the County Name or Section number on the individual records. You can get that at query time from a join with the Areas table.

  7. #7
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    111
    Quote Originally Posted by Dal Jeanis View Post
    I'm missing something. What's the StateLoc table? Is that where the user's individual records are stored?

    Your Areas table already has the the county abbreviation and county name and section, right? And the County Abbreviation is unique, right? So if you store the county abbreviation on the iundividual records, you don't need to store the County Name or Section number on the individual records. You can get that at query time from a join with the Areas table.
    That is correct. I guess I do not really need to store the Section value in the StateLoc table.

  8. #8
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Yeah, that's the wonder of normalization. It takes a bunch of headbanging before it becomes automatic, but after that you save lots of time...

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

Similar Threads

  1. Replies: 4
    Last Post: 09-04-2013, 06:40 AM
  2. Replies: 1
    Last Post: 06-24-2013, 05:14 PM
  3. Replies: 2
    Last Post: 02-20-2012, 10:18 PM
  4. Need to sum up two columns in Access 2007
    By meright in forum Programming
    Replies: 1
    Last Post: 06-21-2011, 04:14 PM
  5. Access 2007 Attachments - Relative reference
    By soringc in forum Programming
    Replies: 0
    Last Post: 11-22-2007, 10:47 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