Results 1 to 6 of 6
  1. #1
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21

    Exclamation Populate Field from Combo Box Selection!

    Hey everyone,

    So I'm just starting to create this database and I'm already having trouble.
    The function of my database is for employees to enter maintenance problems and then they will be updated so that everyone can monitor progress.
    Here's what I'm having a problem with:
    I have two tables: Main Table, Unit # Table
    Main Table has a bunch of fields along with "Unit #" and "Area".
    Unit # Table also has "Unit #" and "Area" BUT the Unit # Table has the two fields corresponding to each other.
    I want the user to create a new record and choose a "Unit #" from a combo box which has the records from the "Unit # Table". Then, depending upon which "Unit #" was selected, the corresponding "Area" record from "Unit # Table" would populate the "Area" field in "Main Table".
    How exactly would I go about doing this.


    Thanks in advance and if this doesn't make sense or if you want more information, just let me know.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Advise not to use spaces or special characters/punctuation (underscore is exception) in naming convention. Better would be UnitNum or UnitNo or Unit_Num.

    Why do you need to save the Area value as opposed to the record ID?
    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
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21
    Thanks for your response and thanks for the tip. I want to populate the "Area" field in "Main_Table" with the same "Area" field from "Unit_#_Table" that corresponds to the "Unit #"

    Maybe I'm missing what you are saying. Could you go into more detail please. Thanks again.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I presume each record in Unit_#_Table has a unique ID field. That can be an autonumber field or a custom identifier (is Unit_# an autonumber or custom ID?). Your options are to save the ID or Area value into Main_Table. If you save the ID then the Area would be retrieved in query that joins tables on the PK/FK ID. Point is, there is normally no need to save both. So unless the Area value will change in the future and don't want current records impacted by that change, no reason to save Area if the Unit_# is saved into Main_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.

  5. #5
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21
    Okay, yes it is an autonumber field. I guess my question is how do I save the ID in the Main_Table? It's probably easy, I'm just drawing a blank on it.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can use a combobox to aid in selecting Unit_# record. Review http://www.datapigtechnologies.com/f...combobox3.html

    Are there any other fields in the Unit_#_Table?

    What is Main_Table for - what is the data?
    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: 9
    Last Post: 07-20-2015, 10:55 AM
  2. Replies: 1
    Last Post: 07-11-2012, 08:36 AM
  3. Replies: 2
    Last Post: 06-20-2012, 09:49 PM
  4. Replies: 33
    Last Post: 01-13-2012, 07:44 AM
  5. Replies: 4
    Last Post: 01-24-2011, 07:11 PM

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