Results 1 to 9 of 9
  1. #1
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20

    Subform using LookUp field

    I have two tables: tblParties and tblCashbook. The table tblCashbook has a field named Party. I used the Lookup Wizard... as the data type in the design view. In the wizard, I used the "I want the lookup field to get the values from another table or query" option. The values are a column named PartyName from the tblParties table. This way, in the datasheet view the user can use the dropdown menu to select a party by its name.


    Everything is working so far.

    Now I want to create a form. The form should allow the user to jump to the party entry in the tblParties table when clicking on the party field in the form (of the tblCashbook table). How am I supposed to do that?
    What I did in previous Access databases was having a field that simply stored the ID of a row in another table (foreign key) which allowed me to use the subform widget in the form designed to display the data of that second table within that form.

    Thanks for your help.


    ~ Tectu

  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,626
    I NEVER build lookups in table. I build comboboxes on form.

    Why do you want to open record of tblParties from tblCashbook form?
    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
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thanks for your quick answer.

    Let me begin by telling you that I have never used Access before. So it is very likely that I am doing it wrong so far
    I want to be able to open a record of tblParties from the tblCashbook form to get quick access to the information of said party (eg. e-mail addresses and other information).


    ~ Tectu

  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,626
    Maybe better options:

    1. multi-column combobox bound to Party field in tblCashbook that lists the records from tblParties and textboxes that reference columns of combobox in order to display party info (these controls would be locked to prevent editing)

    2. include tblParties in form RecordSource - join type "Include all records from tblCashbook and only those from tblParties that match", bind textboxes to fields of tblParties and lock them to prevent editing - select party from combobox and info from related record will display in the textboxes

    3. DLookup() expressions in textboxes
    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
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thanks for your recommendations.
    When doing this in the form only, I would just have a normal number field in the actual tblCashbook table that is not linked to the tblParties in any way and the actual lookup just happens within the form?

  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,626
    That is correct.
    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.

  7. #7
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thank you for your quick replies. I will try implementing this that way in the following days.

  8. #8
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    I tried to implement this the way you suggested but I fail to do so. As mentioned before I don't have any previous Access experiences.

    What I did so far: Add a field named PartyNumberID to the tblCashbook table. The field is of the type ShortNumber. Is that correct so far? What I want to do next is to create a form which will provide the user with a ComboBox (not editable) that lists all the parties from the tblParties table. When a party is selected the corresponding ID (primary key) of the record in the tblParties table needs to be added to the PartyNumberID field of the tblCashbook table. For this I add a ComboBox to the form and in the Wizard I select the first option: "I want the combo box to get the values from another table or query". And from here I am a bit lost. How do I continue? How do I implement the logic that the user sees the name of the party in the ComboBox but that on selection the ID of the selected party is added to the tblCashbook table?

    Thank you for your help.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Combobox must be editable in order to select item from dropdown list. It must be bound to PartNumberID field to save the selected value.

    Review 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.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-31-2014, 11:37 AM
  2. Focus on subforum page
    By rumenrs in forum Forms
    Replies: 2
    Last Post: 04-13-2013, 12:29 PM
  3. Replies: 1
    Last Post: 02-29-2012, 10:13 PM
  4. Help with lookup field
    By GregF in forum Forms
    Replies: 2
    Last Post: 01-02-2012, 06:10 PM
  5. Use a lookup field to influence values in another field
    By nathanrt in forum Database Design
    Replies: 3
    Last Post: 01-13-2011, 03:40 PM

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