473,661 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Discussion: Advantages of a Subform vs. Filtering

zmbd
5,501 Recognized Expert Moderator Expert
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 4599
Rabbit
12,516 Recognized Expert Moderator MVP
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 Recognized Expert Moderator Expert
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, 1352 views)
May 16 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
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 Recognized Expert Moderator Expert
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
1466
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 filtered by several fields. I have set up several text boxes which programatically show various OnCurrent subtotal details depending on the filtered options in the continuous subform.
2
4792
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. They are linked by the load_id field and when I just browse through the loads everything shows up correctly. Each recorded group is displayed on a line of the datasheet subform. However, when I filter the form for say my "Selected" flag...
6
9335
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 a checkbox with a control source named "MARK" (boolean) from customer table. I can check and uncheck individual records fine. Then I created 2 command buttons named "Select All" and "Deselect All". The Onclick property of these buttons runs code...
1
1584
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 tblmain but now I need to have them enter data each day for each student so I have a new table tbldata that has TimeStart, TimeEnd how can I make a list of students in a subform like I have now created from tblmain, and filtered(so far so...
1
2410
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 there a way of doing this? Tried a lot of different things but it doesnt want to play... HELP!
25
14831
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 SubForm. I have a PrintButton on MainForm that opens the report! At this moment my MainReport is being filtered and sorted excatly the way the MainForm is, and I was trying to get ma SubReport to be filtered and sorted the way the SubForm is. I'm...
9
3078
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
2335
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 & Credit Region. The subform displays the data/records. The record source for both my form and subform is driven by a query, which is the way I filter the records that the end user will see via another form I created. Everything is working fine but...
0
1685
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 = 'product') I've not used an In clause before. Thanks a lot for the education.
4
4115
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 on the main form that I'm going to be using to submit the data. The main form is bound to a query, qryPatientDetail, and is filtered using a search form. The subform is currently linked to the main form with PatientDetailID as the Master and...
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.