473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Re: How to Filter subforms contained in TABS

Maybe you could try using a query as the recordsource for your subforms
and for the criteria field in the query you could use a Form parameter.
This way - instead of using the form filter property you could set a
value in a textbox on your mainform which would filter the query. This
way all of your subforms are synchronized.

fieldname: fldx
Criteria: Like Forms!Form1!Text0

Text0 would be a textbox on your main form (Form1 or whatever it is
called) if the main form is called mainform then

Forms!mainForm!TextBox1

Note: that I am using the 'Like' keyword in the Criteria. This is if
your criteria field is a text field. Then you can use wildcards like
j*. This would retrieve records where the criteria field starts with a
j.

Then add a button to the mainform to force updates when you change the
criteria. In the code section for the button add this code:

Private Sub Command1_Click()
Me.Requery
Me.Refresh
End Sub

This will work - I just tried it on my machine (Access2003), but you may
have to recreate the forms and the query a few times to get it straight.
Rich

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 9 '08 #1
4 5359
I think you're over engineering this. If you're saying that all three
subforms are based on the same table, and you're using subforms because your
form was too crowded for a standard interface, you don't need to use subforms!
Use the tabbed pages, but simply place the fields from the table on the
tabbed pages, twenty to a page, not thru subforms. Then anything you do on
one page, like filtering on a field, will be reflected in all pages.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200809/1

Sep 9 '08 #2
Hi Linq, yes, I tried this and it does work, HOWEVER, the issue I have
is that the sub form has to be a continuous form, so when I do it this
way, the tabs get repeated on each row of data, and so do all the
headers for the fields. It does work but it looks messy....
So I use the subforms mainly for the formatting, looks cleaner.

thanks
vince
On Sep 9, 1:53*pm, "Linq Adams via AccessMonster.com" <u28780@uwe>
wrote:
I think you're over engineering this. If you're saying that all three
subforms are based on thesametable, and you're using subforms because your
form was too crowded for a standard interface, you don't need to use subforms!
Use the tabbed pages, but simply place the fields from the table on the
tabbed pages, twenty to a page, not thru subforms. Then anything you do on
one page, like filtering on a field, will be reflected in all pages.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2008...
Sep 10 '08 #3
On Sep 9, 11:28*am, Rich P <rpng...@aol.comwrote:
Maybe you could try using a query as the recordsource for your subforms
and for the criteria field in the query you could use a Form parameter.
This way - instead of using the formfilterproperty you could set a
value in a textbox on your mainform which wouldfilterthe query. *This
way all of your subforms are synchronized.

fieldname: fldx
Criteria: * *Like Forms!Form1!Text0

Text0 would be a textbox on your main form (Form1 or whatever it is
called) if the main form is called mainform then

Forms!mainForm!TextBox1

Note: *that I am using the 'Like' keyword in the Criteria. *This is if
your criteria field is a text field. *Then you can use wildcards like
j*. *This would retrieve records where the criteria field starts with a
j.

Then add a button to the mainform to force updates when you change the
criteria. *In the code section for the button add this code:

Private Sub Command1_Click()
* Me.Requery
* Me.Refresh
End Sub

This will work - I just tried it on my machine (Access2003), but you may
have to recreate the forms and the query a few times to get it straight.

Rich

Rich

*** Sent via Developersdexhttp://www.developersdex.com***
Thanks Rich, but your method would work nice if it were only one field
that the user is filtering on. In my case ALL fields can potentially
be filtered on. That is why I use the right click method instead of
trying to create my own filter selection criteria with text boxes
Sep 10 '08 #4
Hello again,

It sounds like what you need is a dynamic subform where you only display
the fields you need to see at a given time. Here is how you create a
dynamic subform:

In a single subform add 60 unbound textbox controls. Name them txt0,
txt1, txt2, ... txt59 (not 1 through 60 because ordinal counting starts
at 0 -- For i = 0 to 59)

In the main form you can have a listbox which displays the entire list
of fields in this table. The user selects the fields to be displayed.
In another listbox list all the fields. These will be the fields to be
used as criteria. You can then have 5 or 10 hidden textbox controls on
the main form (or how ever many textboxes for the max number of
criterias you would have in a Where clause). When the users selects
fields to be queried you unhide a textbox for each field selected to be
queried on. From here you build your sql string based on the fields
selected to be displayed and the fields selected as criteria. Then you
set the Subform's record source to this sql query string. Then you bind
the number of textboxes in the subform to the number/name of the fields
selected to be displayed.

Here is a sample of what the code looks like - In my sample I use 2
command buttons (just a simple example). In the first command button I
set the recordsource of the subform and the controlsource of 2 textboxes
to 2 fields from a table called tbl2. In the 2nd command button I set
the recordsource and controlsource of 2 more fields (actually the first
field is the same, but the 2nd field is different).

Private Sub cmd0_Click()
Me.frmMain2Sub.Form.RecordSource = "Select * from tbl2"
Me.frmMain2Sub!Txt0.ControlSource = "RecID"
Me.frmMain2Sub!txt1.ControlSource = "FName"
Me.Requery
Me.Refresh
End Sub

Private Sub cmd1_Click()
Me.frmMain2Sub.Form.RecordSource = "Select * from tbl2"
Me.frmMain2Sub!Txt0.ControlSource = "RecID"
Me.frmMain2Sub!txt1.ControlSource = "LName"
Me.Requery
Me.Refresh
End Sub

In your case - instead of hardcoding fieldnames - you would just select
the fields the user selected from the Listboxes - use a For Loop (thus
Ordinal numbering). Anyway, this is how you would build a dynamic
subform.

Rich

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 10 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tony Williams | last post by:
Sorry to repost but I cannot work this out. Can anyone come up with a suggestion? I have a main form based on Table1. The form has a tab control of three pages. Each page has a subform based on a...
6
by: Steve | last post by:
I have a form, primary subform and secondary subform. A tab control takes up all the area of the primary subform. There are about 15 tabs on the tabcontrol. Each tab contains fields from the same...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
3
by: dhowell | last post by:
In reading some of the posts on this group, it appears as though it is not strait forward at all to filter a form, which has subforms, by criteria which are either on subforms or span more than one...
4
by: microb0x | last post by:
I have an application with a master form with a tab control containing nine tabs, each tab contains a subform. I have command buttons on my main form including: Save , Cancel , Close. My...
5
by: Keriana30 | last post by:
I have a Main form with several tabs. Each tab contains subforms that hold various employee information regarding benefits, dependant coverage, retirement, etc. I have a Save and cancel function on...
4
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
3
by: sara4 | last post by:
I have a form with 2 subforms on it. The 2 subforms have a table-valued function as their recordsource and the input parameters property that 'reads' the parameter values (field values) from the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.