Results 1 to 12 of 12
  1. #1
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7

    relating fields from one table to a form


    I am very new to Access. I am using Access 2007 and trying to create a very simple database which tracks inventory, contacts and events. I have first name, last name and company fields in my event form which I would like to automatically populate from my contact form. Is there a way to either; start typing a name in the event form and it would be found in the contacts form or if it isn't found I could add it as a new record to the contact form? Or is it possible to, when in the first name field of the event form, it would list the names in the contact form and if selected it would be filled into the event form (first name, last name and company)?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Don't save the contact info in the events table, just the contact table primary key ID. Use a combobox to select contact. If contact not in the dropdown list, use NotInList event to add new contact record.

    Review:
    http://datapigtechnologies.com/flash...combobox3.html
    http://support.microsoft.com/kb/197526
    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
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    Thanks June7 - appreicate the help! Works great, one question tho', in my bound box (created from a query with "first name", Last Name" and Company", is it possible to have all three field show after having been selected?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Concatenate the fields in the RowSource sql. The result will be one field instead of the 3 separate so adjust combobox properties accordingly.

    SELECT ID, [Last Name] & ", " & [First Name] & " : " & Company AS Customer FROM tablename ORDER BY [Last Name], [First Name];
    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
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    I'm sorry, but does "concatenate the fields in the RowSource sql" mean to put it into Visual Basic?

  6. #6
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    I found where to put the code you sent, however, when I launch the form and click on the "combo box" I get this message "the record source '~sq_cEvent~sq_cCombo55' specified on this form or report does not exist"?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    My suggestion was to use that SQL statement in the combobox RowSource property, has nothing to do with VBA. I have no idea what you actually did.
    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
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    Yes, I did figure out how to get to the SQL statement in the combo box row source property and put in: SELECT ID, [Last Name] & ", " & [First Name] & " : " & Company AS Customer FROM tablename;
    when I went back to the form view and clicked on the box was when I got this message "the record source '~sq_cEvent~sq_cCombo55' specified on this form or report does not exist"?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Did you use your real field and table names in the SQL as opposed to the generic references in my example? Is ID name of the unique identifier field? I presume the real table name is not 'tablename'.
    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.

  10. #10
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    Got it!. . .. .apparently just a misspelling, appreciate all the help!

  11. #11
    ljmellor is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2012
    Posts
    7
    ok, now I have my list of contacts showing on a record, when I go to select one, that contact is put into all of the records? Any suggestions?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Must set combobox ControlSource property to the field that the value is to be saved in. Value selected for an unbound control will be reflected in all instances of the control - it is, after all, only one control.
    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: 5
    Last Post: 07-14-2019, 05:22 PM
  2. Issue with relating a 4 table database
    By jmorgan_mpe@yahoo.com in forum Database Design
    Replies: 1
    Last Post: 04-24-2012, 08:15 AM
  3. Database design- need help relating fields
    By sebeckett in forum Access
    Replies: 5
    Last Post: 09-02-2011, 02:21 PM
  4. Replies: 9
    Last Post: 04-01-2011, 12:28 PM
  5. Replies: 1
    Last Post: 11-11-2010, 11:00 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