Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Control Issue 1

Status
Not open for further replies.

Gaupo

IS-IT--Management
Feb 19, 2004
13
US
I have a form with three tabs all pulling from one query off the main form. I have a combo on each of the tabs that list a different type of publication based on filtering. The problem is on each of the tabs I can see all data from the table. How can I filter out data other than what is requested using the combo box (dropdown) I am filtering the form based on what the user selects in the combo box.

This is in access 2003
 
Just quick thoughts - If what you want is for the fields to be visible or not. You can set up a code to make those fields appear or disappear dependent on the combo box value.

I did this for a form with tabs, using the form's on current event and putting in an if/then statement. You can make combinations by adding separate visible true/false statements for various fields.

If Me.Comboboxname="value" then
Me.field.Visible = False
Me.field2.Visible = True
Else
Me.field.Visible=True
Me.field2.Visible=False
End If

I am not sure if this is what you are looking for, or if you are just looking at having each tab have a subform based on a different parameter query from the main table using a criteria expression that pulls data based on the value listed in that tab's combo box....
 
Your last statement is what I am looking for, but the form is pulling data from one query which I use different expressions on. The data still shows for all line items on each Tab, but using the combo box and choosing a selected item does bring that item up.

I am having difficulty getting my point across. I just want to see what should come up on choosing from the combo box and not be able to see other data that should only be seen on one of the other tabs.
 
I am not sure I understand...but here is another guess.

I am assuming that you have a # of fields in the one query and on each tab you only have a portion of those fields, then by choosing a specific value in the combobox you want some of the data to not be filled in or you want only the record/data for one record to show up?

If you have all of the fields in your query and you don't care if the labels/fields show up on each tab, but just don't want the actual data showing up in them, then one idea would be to set a code in the combobox's after update event and possibly in the form's on-current event that says something like:

If Me.comboboxname="value" then
Me.textboxname.ControlSource = "" 'not connected to table field
Else
Me.textboxname.ControlSource=[Table Field Name] 'connected to table field
End If

You could add multiple fields and variations to this If/Then statement to make other fields look empty. You can also make different tabs visible or not in the same if/then statement.

Or If you have a combobox that queries so that only a specific record/data shows up and all of the data for all records are still there, then the query criteria may not be phrased correctly or the combobox name may be misspelled... When you open the query separate from the form and put in the required combobox values, are the results correct?

Sometimes, I have had better luck when I have made separate forms, each based on a query that has fields and criteria specific to that form instead of an all fields in one query

For example, if I had a form with a tab control where Contact info is on one tab, the Training info is on another tab, the Position info is on yet another one and I had a combo box on each tab to aid in pulling the correct information - then I would make separate queries for each based on the value from that tab's specific combo box.

It might help if you gave a brief description of what type of fields you have one each tab and which ones you don't want to have filled in if the combobox is an example value. Also what criteria you are using for the query.

Others may be able to respond better than I...
 
All the same fields are on each of the Tabs, the only difference between each of the Tabs is Criteriaused in the combo box to select it's contents.

I know this is very hard to understand through email and I am not very good at giving you a good perspective.

But again I only want what the items in the combo box that met the criteria of the query statement.

Thanks again for taking the time to converse about this..
 
How are ya Gaupo . . . . .

You need 3 seperate subforms (different names same form) with the same [blue]RecordSource[/blue].

In the [blue]AfterUpdate[/blue] event of each combobox set the [blue]Filter & FilterOn[/blue] properties.
Code:
[blue]   Me!Filter = "[purple][b]'[/b][/purple]" & Me![purple][b]ComboboxName[/b][/purple].Column(1) & "[purple][b]'[/b][/purple]"
   Me!FilterOn = True[/blue]
The code assumes data is Text. If numeric, remove the single quotes.

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top