+ Reply to Thread
Results 1 to 12 of 12

Combobox Selection To Run Query

  1. #1
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Unhappy Combobox Selection To Run Query

    Hi

    Can anyone tell me how I can achieve the following in simple steps.

    I have a form that will show static data in textboxes that are in the form detail and form header based on the selection of a job number in a combobox that is in the form footer.

    The data has to come from 2 different tables. I assume I have to create a query based on the data i want from each table. How do I link the combobox selection to the query criteria: so that it only returns the data for that job number and once that is done how do I get it to display in the form textboxes.I know how to get the combobox to populate the textboxes with data from one table.

    Any help would be much appreciated

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    I am not sure that I understand completely, but I think this may be what you are looking for. While this is about building a search form, the methodology may apply if I am understanding your request.

    http://www.datapigtechnologies.com/f...earchform.html


    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Combobox Selection To Run Query

    Alan

    Thats something like I'm looking for, what I need is that when I click on the combobox and select a job number it will run the query and populate the text boxes on the form with the relevant data in the query. What the tutorial is doing is running a query based on something I would have to type into a parameter box and it is opening a table not populating the textboxes.

    Any suggestions or other tutorials would be appreciated

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    You will have to make the recordsource for the form the query.

    Alternatively, if you are only looking for one record, then look at this tutorial on filtering to obtain only one record and have it displayed in your form.

    http://www.datapigtechnologies.com/f...tomfilter.html

    Alan

  5. #5
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Combobox Selection To Run Query

    Alan

    Thats pretty close to what I am looking for. So I can take data from multiple tables link them to each other and put into the query to display on the form is that correct

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    Sure. When you build you form, make the query your recordsource.

    Alan

  7. #7
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Combobox Selection To Run Query

    Ok

    Got it working my only problem is now in the combobox it's only showing 1 record when there are 3 in the table. Any idea why it was showing the others before

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    Is your form in datasheet view? or Normal View?

    Alan

  9. #9
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Combobox Selection To Run Query

    form is in Form View

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    In order to see more than one record at a time, you will need to change the form to datasheet view, but then you will lose any command buttons on the form. An alternative is to have the search on the main form and have the results come back to you in a subform inserted into the main form.

    While in the main form does it show a record count at the bottom of 1 or more?

  11. #11
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Combobox Selection To Run Query

    Yes it shows 4 records but when i click each record the form is blank other than the one record I can see

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,858

    Re: Combobox Selection To Run Query

    At this point, I have run out of ideas. Perhaps it is time to post a copy of the db. Please remove all confidential data and replace with dummy material. Additionally, do a compact and repair before posting. BTW, you should do a C&R regularly during development as Access tends to get bloated as you build objects and then delete objects.

    I will look at it over the weekend and see if I can solve your issue.

    Alan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1