473,385 Members | 1,872 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,385 software developers and data experts.

Discussion: Advantages of a Subform vs. Filtering

zmbd
5,501 Expert Mod 4TB
Ok,
So I've created forms with both filtering as in
http://bytes.com/topic/access/insigh...filtering-form, same concept with cascading comboboxs, and I have used Main/Subform formats too for related tables/queries.

I think it is my inexperience in that I do not see the inherent advantages of the subform vs. the filtered form and have used both methods depending on what forms I'd already constructed (and their underlying vba). Both methods appear to correlate the related record(s), both can allow editing, deleting, and adding records and so forth.

When and why would one method be a better solution than the other?

I've tried Google/Bing/etc... to find an article about this without much success and I haven't seen a discussion, or at least the search didn't return it, here about it either.

The discussion would be great, a link(s) pointing me in the correct direction is also appreciated.

-Z
May 16 '12 #1
4 4577
Rabbit
12,516 Expert Mod 8TB
Filtering is used to find records that match a set of criteria while a subform is used to show related records in a different table. They're used for different purposes.
May 16 '12 #2
zmbd
5,501 Expert Mod 4TB
OK,

Rabbit... today, I seem to be more of the tortoise and mule... slow and dense:

I understand the concept behind the subform. I use them quite often if I need to show related information for either different but related queries or from different but related tables at the same time (not just a single table/query, but two or more in their own subform) - which is the only adavantage I've seen thus far.

So, let me try this with a different slant. Using just two related tables from many: Let us say, I have a database with a table lisiting inventory(and supporting tables), a table with possible installation points (systems... storage area are treated as installation locations), and a history table that tracks the inventory: when received, when and where it was installed to/removed from a given system, maintenance record, and when discarded. The history table is a "snapshot" in time as we need to be able to trace the who/what/when/where incase of issues or audits.

So let's take a look at the history table.
Expand|Select|Wrap|Line Numbers
  1. tbl_history
  2. [hist_ID] - Autonumber - PK
  3. [FK_tblinv_id] - Long - required - Foriegn Key from inventory table.
  4. [FK_tblsys_id] - Long - required - Foriegn Key from the systems table.
  5. [FK_Action_ID] - Long - required - Foriegn Key from the actions table.
  6. [FK_Employee_ID] - Long - required - Foriegn Key from the Employee table.
  7. [comments] - text(100)
and the second... something along the lines of:
Expand|Select|Wrap|Line Numbers
  1. tbl_inventory
  2. [inv_ID] - Autonumber - PK
  3. [FK_tblprd_id] - Long - required - Foriegn Key from inventory table.
  4. [inv_sn] - text(50) - required.
  5. [comments] - text(100)
So there are tons of queries and forms that can be created to view tbl_history.

Normally, I'll query the history table for a given inventory item, get the human readable names from the supporting tables, build the reports, etc...

However, we don't always need a paper report, just the information for review; thus, to do the same thing using a form; In the header, using a series of cascading comboboxes based on the tbl_inv (if the user doesn't know the [FK_tblinv_id] otherwise there is a textbox) to filter down the history table... set the filter... voila... the related records from tbl_history as per NeoPa's example. The nice thing here, is that I can use the human readable text in the cbobox.

Now, I can do the same thing using a subform. Create the master form showing the inventory item's [INV_ID][Manfacture][Desctiption] etc... build the subform based on tbl_history linking the realated parent/child field ([INV_ID]:[FK_tblinv_id])... once again, I get the same information that the filtered form version gave me (ofcourse I would base the forms on a query otherwise the FKs would be numeric instead of the human desired text).

Heres an example from a production db showing both a form_subform and a filtered form for the same information:



So, where is the advantage?

-z
Attached Images
File Type: jpg FrmSubFrmFltrQnA.jpg (53.0 KB, 1347 views)
May 16 '12 #3
Rabbit
12,516 Expert Mod 8TB
I think in this case I would go with a subform. Simply because it requires no code. So it will work even if the user has vba/macros disabled. I avoid code whenever possible because of that.
May 16 '12 #4
zmbd
5,501 Expert Mod 4TB
Rabbit, that's a very good point with it working if the vba is disabled.

So it brings another question to mind that I'll start in a new thread about the controls because I'd really like to have other people's opinions regarding this topic here.

-z
May 16 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Karl Roes | last post by:
Hi All, I would also like some help with form filtered differences in totals. I have a main form for the client, and a continuous subform listing client transactions. The subform can be...
2
by: origin197511 | last post by:
Hello all... I'm having an issue with MSAccess 2000. I have a Form that holds records of my cartridge loads for a rifle and a subform that lists all groups that have been fired with that load. ...
6
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is...
1
by: sparks | last post by:
I have a main table with teacher names and students I can put this in a subform and filter by teacher name so I have a list of her students in a sub form. the problem I have is this is created in...
1
by: Elainie | last post by:
I have a main form and in it I have a datasheet subform filtered on surname, I would like the users to select a name in their list on the subform then the data moves up into the main form... Is...
25
by: hjozinovic | last post by:
Hi! I have a MainForm and a SubForm on it. They're linked and can be filtered, sorted etc... I designed MainReport and SubReport that should match filter and sort criteria from MainForm and...
9
by: angi35 | last post by:
Hi - In Access 2000, I have a form I want to filter, but I can't get the syntax right in the code. Form: Subform: Control on : txtStart Nested Subform on : Control on : txtSDate
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
0
by: diogenes | last post by:
"Rick Brandt" <rickbrandt2@hotmail.comwrote in news:bPnKj.456$%41.325 @nlpi064.nbdc.sbc.com: I used this approach, and it works a treat! ID In(SELECT Order_ID FROM orderitems WHERE NAME =...
4
beacon
by: beacon | last post by:
Hi everybody, I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.