Tab Control query problem

C

Cathy

I have a tab control on a form with two tabs.

The first tab has drop downs for the month/year and other criteria. It also
has a button to run a query based on all of the criteria displayed on the
form.

The second tab also has drop downs for the month/year and different
criteria. It also has a button to run a query based on all of the criteria
displayed on the form.

My problem is that when I am on the second tab, it picks up the month/year
field from the first tab in the query results. I does pick up all of the
'other criteria' from the second tab. How do I correct this?

Thank you!
 
D

Dirk Goldgar

Cathy said:
I have a tab control on a form with two tabs.

The first tab has drop downs for the month/year and other criteria. It
also
has a button to run a query based on all of the criteria displayed on the
form.

The second tab also has drop downs for the month/year and different
criteria. It also has a button to run a query based on all of the
criteria
displayed on the form.

My problem is that when I am on the second tab, it picks up the month/year
field from the first tab in the query results. I does pick up all of the
'other criteria' from the second tab. How do I correct this?


If you have different combo boxes on each tab, then they must have different
names. Check their names. From the sound of it, either the query being run
on the second tab is referring directly to the combo boxes on the first tab
(as criteria), or else the code behind the button on the second tab is
mistakenly using the combos on the first tab as filters when opening the
second tab's query. Check the query, and check the code. If you can't
figure out what to do, post the SQL of the query and the code behind the
button.
 
G

George Nicholson

MyTabControl, MyDateTimeOnTabOne and MyDateTimeOnTabTwo are all members of
the MyMainForm.Controls collection, and as such, must have unique names.
Individual tabs do not have their own Controls collections.
My problem is that when I am on the second tab, it picks up the month/year
field from the first tab in the query results.

Given the above, I'm not sure how that is possible unless you are
referencing the same control in both queries. How are you referencing them
in the queries? (i.e., how are your queries "picking up" values?). I assume
we are talking different queries for tab one and two.
 
C

Cathy

I've never worked with queries against tabs before, and I didn't build this
application... But your diagnosis was correct. It had the same control names
on both tabs for the month and year.

Thank you so much. Your fix works perfectly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top