Results 1 to 4 of 4
  1. #1
    TwoDodges is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    7

    Field from a query related to sub form on main form


    I am trying to update a form in a data base to display data in a sub form from a selection from a combo box, and to display two of those query fields on main form.
    I have two tables - Members / Autolist, and a query that selects data from the two tables depending on a combo box selection from Members table.

    The Vehicle data is shown in sub form, but I can not get the two relevant fields from Members side [ Firstname ] / [ MemberID ] to display on MAIN form along side the Surname which is displayed by Combo box.
    The form is to only show data when the selection is made from combo box.
    I have tried the options from the "Syntax for main/subforms" without success ....

    Any help appreciated

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Make the combo's row source include the other relevant fields (FirstName, MemberID) then bind your textboxes where you want to show them using the .Column(index)

    Lets say your combo's row source is a query with three fields (SELECT MemberID,Surname,FirstName From Members) with the first column hidden (column width=0); so when you select a Member you see the surname as the first visible column; for the other two textboxes add as their control source:
    "=[cboMember].Column(0)" for the MemberID
    "=[cboMember].Column(2)" for the FirstName

    Obviously adjust for your own control\field names.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    TwoDodges is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    7

    Field from a query related to sub form on main form

    Quote Originally Posted by Gicu View Post
    Make the combo's row source include the other relevant fields (FirstName, MemberID) then bind your textboxes where you want to show them using the .Column(index)

    Lets say your combo's row source is a query with three fields (SELECT MemberID,Surname,FirstName From Members) with the first column hidden (column width=0); so when you select a Member you see the surname as the first visible column; for the other two textboxes add as their control source:
    "=[cboMember].Column(0)" for the MemberID
    "=[cboMember].Column(2)" for the FirstName

    Obviously adjust for your own control\field names.

    Cheers,
    VERY much appreciated and solved my problem once I got the syntax right - Have made a note of the method for future use / problem solving
    Cheers
    JY

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    You're very welcome!
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 12
    Last Post: 12-17-2018, 10:25 PM
  2. Replies: 9
    Last Post: 01-13-2015, 07:30 AM
  3. Replies: 2
    Last Post: 04-30-2013, 07:55 PM
  4. Replies: 11
    Last Post: 01-10-2013, 06:23 PM
  5. Replies: 2
    Last Post: 11-13-2012, 02:11 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