Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 29th, 2006, 02:11 PM
Registered User
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to monocles303 Send a message via Yahoo to monocles303
Default Beginner SQL Programming Question

I am in the process of creating a database that will inventory phone lines. I have 250 offices and each office has a max of 70 lines and 10 types of phone equipment. I did not create one main table because of the 70 lines and several types of equipment per office. Instead, I created 3 tables, one for general office info, one for lines and one for equipment. I have one form for data entry and this form contains 2 subforms (lines, equip). How can I setup this form so that when you enter info on the main form, it is duplicated in the subforms? IE: Office Code is the primary key for both my main table and my line table. On the form and it's subform you must enter this information twice. Once you've entered the info on the main form how can it be duplicated in the same subform field, or better yet a table, so the user does not see duplicate fields?

Monica Harris
Old September 12th, 2006, 03:47 AM
Friend of Wrox
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts

Need more information on your Database table design.
The following tables (from your explanation) are:

OfficePhoneTbl: defines 250 locations.
  OfficeIDPK [Primary Key: numeric and sequential]
  OfficeLocation [textfield, defining location, bldg number,etc]
OfficeIDPK OfficeLocation
1 Bldg 5
2 Bldg 6
PhoneLinesTbl: defines the phone lines, only;
  LineIDPK [Primary Key: numeric and sequential]
  LineDesc [textfield, description of line;
LineIDPK LineDesc
1 Voice Line
2 Data Line, T1

OfficeLineTbl: a Joining of the OfficePhoneTbl and PhoneLinesTbl. This table allows for anyoffice to have more than one phone line per office and easy to maintain. Queries are run against this table with the
  OfficeLineIDPK [Primary Key: numeric, unique and sequential]
  LineIDPK_FK [ForeignKey: Primary key of PhoneLinesTbl allows dupicate values in this case 70 lines per office.]
  OfficeIDPK_FK [Foreign Key: Primary key of OfficePhoneTbl is the foreign Key in this table.Defines which line is at this office.]
OfficeLineIDPK LineIDPK_FK OfficeIDPK_FK
1 1 1
2 1 2
3 2 2
4 2 1
For the equipment, not sure what your database is defining equipment, however I would define it in its on table as the Office table and Line table, then establish the relationships...meaning if the equipment is a phonebox, you will have more than one line per phone box and I would imagine you would need the status of that line in that phonebox at a office building.
  Equipment Desc

If you have any further questions, email me.
Hope this helps.

Similar Threads
Thread Thread Starter Forum Replies Last Post
xslt beginner question cfflexguy XSLT 4 October 16th, 2007 09:11 AM
I am a beginner in the programming and c# ahmedshawki C# 7 August 9th, 2007 01:42 AM
Beginner Question dkr72 Excel VBA 1 January 18th, 2005 09:37 AM
Beginner question on getting only certain elements EstherMStrom XSLT 5 December 10th, 2004 04:38 PM
beginner question saudyonline General .NET 2 September 21st, 2004 01:56 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.