Results 1 to 8 of 8
  1. #1
    danvadis is offline Novice
    Windows 8 Access 2007
    Join Date
    Sep 2015
    Location
    Accra, Ghana, West Africa
    Posts
    5

    How to link different fields making up an address in Data Entry


    I have an address field containing "City", Street Name, and street Address. How do I link these fields together on a form so that when I enter data into the "City" field the rest of the fields making up the address fills in?

  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
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    let's say the form / table you are working in is the Orders form/table - - the Form table's City field needs to be set up as a LookUp type to another table: Addresses

    when one selects a City - the other fields of the Address table are available to be written into your other Orders fields

    in the After Update event of the City field you add the vba to write in the other fields i.e.

    me.Street = me.City.column(2)
    me.StreetNumber = me.City.column(3)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Why save the additional data into Orders (this is duplication of data)? All you need to save is the city or its record ID. As Paul's link demonstrates, expressions in textbox can reference the combobox column index (index begins with 0).

    =[cbxCity].[Column](2)

    No VBA needed.

    If you need better understanding of multi-column combobox, here is another tutorial http://datapigtechnologies.com/flash...combobox3.html
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Addressed in the link that was posted yesterday.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    the reason to write the address into Orders - is to record the actual Order address; people & organizations move - thus if you rely on a link to the Address table, then when it gets changed/updated all orders display the current address even if that isn't accurate for a past order...

    the correct approach is only resolved by knowing what the business requires; in some cases a link is very adequate and preferable - - in other cases losing the old information is definitely a bad idea.... I once worked on a db for a client that used the linked method for the sales tax % rate - - and when they changed taxed rate all their past invoices had differing amounts that didn't agree with their accounting info... but in other cases a link is totally preferable. So it can go either way.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Alternative is to create a new record and 'deactivate' the old one.
    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.

  8. #8
    danvadis is offline Novice
    Windows 8 Access 2007
    Join Date
    Sep 2015
    Location
    Accra, Ghana, West Africa
    Posts
    5
    I used the = [cbxcity].[Column](2) method you directed and it worked. No VBA as advised.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2013, 12:02 AM
  2. Create LINK/LOOK UP in data entry form
    By marcvanderpeet12 in forum Forms
    Replies: 1
    Last Post: 08-08-2013, 07:44 AM
  3. Making data entry more efficient in a form
    By Gambit17 in forum Forms
    Replies: 4
    Last Post: 08-02-2013, 10:24 AM
  4. Form for new data entry which link to another table
    By marcvanderpeet12 in forum Forms
    Replies: 3
    Last Post: 06-12-2013, 09:47 PM
  5. Replies: 4
    Last Post: 01-13-2013, 02:40 AM

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