473,657 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform and queries

Friends,
My database has 5 different tables (tbl1, tbl2, tlb3, tbl4, and tbl5)
with the same fields: ID, SSN, LNAME, FNAME, RECEIVED and CLOSED. The
ID is the PK and its autonumber.

Obiously different data is stored in each table according to the type
of work my office handles. The database is used for a small insurance
company.

I have created a form on which added subforms each of which has it's
record source to a different query based on each of the above tables.I
give criteria to these queries using a form:
forms![myform]![mytxtbox]. It works fine. The form opens and displays
all the subforms with its data (SSN, FNAME, LNAME, RECEIVED and
CLEARED).

Since I would like not to repeat data like SSN, FNAME or LNAME more
than once, I was thinking of a way to display this information only
once. The problem is I could use one subform as the master one to
display the SSN, FNAME and LNAME, adn the other ones to display all
the other information, but it could be that that specific table (tbl1)
does not have that data but this has only been stored in tbl2 and
tbl3.

I believe the only way I can do this is using a query based on all the
5 tables an setting the criteria to the SSN again. But still cannot
get it working.

Can any one help me with the solution?
Nov 12 '05 #1
3 1533
DFS
Paolo,

The first part of the solution is to redesign your database. Combine the 5
work tables into one, and create a Customer table:
WorkTable
---------------------
WorkID *
WorkType ++
CustomerID ++
Received
Closed (or Cleared)
(other fields from tbl1, tbl2, etc)
Customer
---------------------
CustomerID *
SSN +
LastName
FirstName
(other fields)
Asterisk is primary key, + and ++ indicates unique index across fields.


"Paolo" <jp***@tin.it > wrote in message
news:9f******** *************** ***@posting.goo gle.com...
Friends,
My database has 5 different tables (tbl1, tbl2, tlb3, tbl4, and tbl5)
with the same fields: ID, SSN, LNAME, FNAME, RECEIVED and CLOSED. The
ID is the PK and its autonumber.

Obiously different data is stored in each table according to the type
of work my office handles. The database is used for a small insurance
company.

I have created a form on which added subforms each of which has it's
record source to a different query based on each of the above tables.I
give criteria to these queries using a form:
forms![myform]![mytxtbox]. It works fine. The form opens and displays
all the subforms with its data (SSN, FNAME, LNAME, RECEIVED and
CLEARED).

Since I would like not to repeat data like SSN, FNAME or LNAME more
than once, I was thinking of a way to display this information only
once. The problem is I could use one subform as the master one to
display the SSN, FNAME and LNAME, adn the other ones to display all
the other information, but it could be that that specific table (tbl1)
does not have that data but this has only been stored in tbl2 and
tbl3.

I believe the only way I can do this is using a query based on all the
5 tables an setting the criteria to the SSN again. But still cannot
get it working.

Can any one help me with the solution?

Nov 12 '05 #2
Thanks,
I realize that this is the best solution, but at this stage I cannot
do this since the database is used in over 40 Units and by over 400
users. If I redesign it now I will need to import data from the old
tables to the new ones and this should be done via code as I would be
sending the update file via e-mail. See, my program is splitted and I
use the _mdb file to sent out updates. The program is used for
statistical purposes and cannot afford to lose data or corrupt
integrity. I will need to import that data from the tables, exactly as
they are showing now.

THanks.

"DFS" <no****@nospam. com> wrote in message news:<10******* ******@corp.sup ernews.com>...
Paolo,

The first part of the solution is to redesign your database. Combine the 5
work tables into one, and create a Customer table:
WorkTable
---------------------
WorkID *
WorkType ++
CustomerID ++
Received
Closed (or Cleared)
(other fields from tbl1, tbl2, etc)
Customer
---------------------
CustomerID *
SSN +
LastName
FirstName
(other fields)
Asterisk is primary key, + and ++ indicates unique index across fields.


"Paolo" <jp***@tin.it > wrote in message
news:9f******** *************** ***@posting.goo gle.com...
Friends,
My database has 5 different tables (tbl1, tbl2, tlb3, tbl4, and tbl5)
with the same fields: ID, SSN, LNAME, FNAME, RECEIVED and CLOSED. The
ID is the PK and its autonumber.

Obiously different data is stored in each table according to the type
of work my office handles. The database is used for a small insurance
company.

I have created a form on which added subforms each of which has it's
record source to a different query based on each of the above tables.I
give criteria to these queries using a form:
forms![myform]![mytxtbox]. It works fine. The form opens and displays
all the subforms with its data (SSN, FNAME, LNAME, RECEIVED and
CLEARED).

Since I would like not to repeat data like SSN, FNAME or LNAME more
than once, I was thinking of a way to display this information only
once. The problem is I could use one subform as the master one to
display the SSN, FNAME and LNAME, adn the other ones to display all
the other information, but it could be that that specific table (tbl1)
does not have that data but this has only been stored in tbl2 and
tbl3.

I believe the only way I can do this is using a query based on all the
5 tables an setting the criteria to the SSN again. But still cannot
get it working.

Can any one help me with the solution?

Nov 12 '05 #3
Paolo:

Sounds like you need a Union query as the data source for your parent
form, so that all the SSNs are captured:

(SELECT SSN, LNAME, FNAME FROM tbl1)
UNION (SELECT SSN, LNAME, FNAME FROM tbl2)
UNION (SELECT SSN, LNAME, FNAME FROM tbl3)
UNION (SELECT SSN, LNAME, FNAME FROM tbl4)
UNION (SELECT SSN, LNAME, FNAME FROM tbl5);

You can't do that query in the GUI interface; you have to go into SQL
view and paste it in.
Unsolicited comment: As another respondent mentioned, your database
schema is truly horrible.

For instance, unless you have guaranteed that each unique SSN has
only 1 unique LNAME and FNAME tied to it, then when you run the Union
query above you can have a given SSN show up more than one time. That
in turn can cause data to be duplicated, triplicated, or worse. Which
can *really* mess up things.

One way to mitigate the duplicated SSN problem is to have the Union
query above pull *only* the SSN. Then display the name info via some
other means (perhaps a separate subform).

You said the database was used for statistical purposes; imagine how
badly your stats can be messed up by duplicated data. I urge you to
think a little bit more about redesigning your database, rather than
dismissing the suggestion outright.

Good luck!

-Matt


On 28 Feb 2004 03:10:57 -0800, jp***@tin.it (Paolo) wrote:
I believe the only way I can do this is using a query based on all the
5 tables an setting the criteria to the SSN again. But still cannot
get it working.


Nov 12 '05 #4

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

Similar topics

3
13407
by: A Clark | last post by:
I have a subform that displays a datasheet. There are a couple of different queries that can be displayed in the datasheet. The queries are available in a combo box on the main form. The problem I am having is that when I change the query all the column widths remain the same. This doesn't look very good. I can't figure out a way to set the column widths. I have tried.. Subform.controls(Name of Column).columnwidth = IntColumnWidth
25
10220
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
0
2013
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
4
7002
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
12
1997
by: Paul T. RONG | last post by:
Is it possible to divide a tall subform with 80 records to two subforms each with 40 records? Dear All, What I have: Tables: tblProduct, tblOrder, tblOrderDetail
4
1327
by: Ig | last post by:
Hi, I have a main form, subform in it, and two command buttons on the main form - "Save and Close" and "Cancel and Close". What code should I put into "Cancel and Close" button in order to undo changes in the subform as well? Putting Undo code for subform there seems already late. Generally, what are the guidelines for saving or undoing updates in such structure? Thanks
30
8896
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform named "sbfrmParts" with a list of parts along with the quantity and price. I have used a text box in the subform's footer and set the control source to "=Sum(*)". I set the format to display currency. This text box is called "SubformTotal", and is visible property is set to "No". On the main form I have made another text box and set its control source to "=.Form!SubformTotal". When I enter some parts everything works...
8
8321
by: Robert | last post by:
I have a form (Worksheet) that works fine by itself. I have now created a seperate form (MainForm) that has a command button in the header and an unbound subform (FormFrame) in the Detail section. when the user clicks the command button, Worksheet is loaded into the subform control. At this point, some of the functions do not work. The user is prompted to enter a Parameter Value. Why wouldn't that form (Worksheet) work the same as a sub...
4
2013
by: aqua404 | last post by:
I know this has been discussed, but I can't find a resolution. I have a subform on a form. The table with the data for the main form has 15,000 records. I am opening and then setting recordsource so as to only pull 1 record. The table where the subform data comes from has 130,000 records. There is a parent/child link. Indexed on those fields. I have set the datasource to the table, SQL statements and a number of different queries...
11
7150
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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
8823
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...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
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
6163
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1604
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.