Results 1 to 6 of 6

Thread: Populating a subform with data from a query

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    3

    Question Populating a subform with data from a query

    Hi.

    I am struggling with a problem...
    I have a form called Car_Search. The user selects a parameter such as car manufacturer or types in a model number that s/he wants to search for. The parameters are fed into a query that then returns the data as a datasheet. I would like the returned data to populate a subform that is positioned underneath the search fields within the main search form.

    How can I implement this?

    Thanks!
    Jon

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Populating a subform with data from a query

    Welcome to the Forums.

    On the subform, you can set the "Source Object" to the parent form. Then
    set the "Link Child Field" and "Link Master Field" to their respective fields.
    Then when you filter the parent form it should reflect similar in the subform.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    3

    Re: Populating a subform with data from a query

    Hi.

    Thanks for the quick response.

    I have linked the two together but when I hit the command button to run the query linked to the form (the query takes parameters from the form), I just get a separate datasheet pop up instead of the data passed to the subform?

    Is there a way of taking the data from the query (it is currently displayed in the form of a datasheet that pops up) and feeding that into a datasheet below the main form?


    Thanks again.
    Jon

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Populating a subform with data from a query

    Sorry for the delay.

    If I understand correctly, you have a main form that has a table as a
    recordsource. Then the popup secondary form runs as query but with a
    parameter that the user selected. Now you want to load the datagrid data
    in the popup secondary form back into the first main form?

    Also, these are two separate forms and not a nested subform?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    3

    Re: Populating a subform with data from a query

    Thanks for the reply but I handed in the piece of coursework today and so do not require any further assistance.

    I can't remember what I did but I changed it in some way.


    Thanks again.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Populating a subform with data from a query

    No prob.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width