#  Other Applications & Softwares  > Access Tables & Databases >  >  Combobox Selection To Run Query

## Mooseman60

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

----------


## alansidman

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

----------


## Mooseman60

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

----------


## alansidman

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

----------


## Mooseman60

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

----------


## alansidman

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

Alan

----------


## Mooseman60

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

----------


## alansidman

Is your form in datasheet view? or Normal View?

Alan

----------


## Mooseman60

form is in  Form View

----------


## alansidman

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?

----------


## Mooseman60

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

----------


## alansidman

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

----------

