Forums

This topic is locked

Referencing Columns from another Table

Posted 25 Jul 2002 20:40:31
1
has voted
25 Jul 2002 20:40:31 carolus Holman posted:
Problem: I have a form with over 300 fields in it, this form has some required fields. I am trying to authenticate the form before "final" submission by ensuring that all field are filled in. This form spans many different pages, and on the SQL end resides in 25-30 tables. Each part of the form can have multiple entries, like contacts for instance can have multiple names...hence the need for dynamically expanding tables. (25 of them).

I have created a table called tblrequiredfields example:

column name: requiredfieldsID (Unique ID)
column name: requiredtablename
column name: requiredfieldname

Sample Data in the tblrequiredfields table:

requiredfieldsID: 12
requiredtablename: tblCompanySetup
requiredfieldname: CompanyPhone

Sample Data in the tblCompanySetup
CompanySetupID: 23382
CompanyName: ABCompany
CompanyContact: John Smith
CompanyPhone: 555-5555
---------------------------------
CompanySetupID: 12368
CompanyName: AnotherCompany
CompanyContact: Bill Johnson
CompanyPhone: <NULL>


Okay now, how can I take the Data from my Required Fields table and use it to compare against the actual tables which contain the data. For instance I would need to run a query that would use the tblrequiredfields DATA and check to see if the corresponding table in the dataset contains the required data. So by using the required fields table I would catch that the second record is missing the CompanyPhone data, based on the requiredtablename and requiredfieldname fields that serve as a lookup.

I am writing Data constraints into the ASP on the front end, however devilish users can always get bad data or skip entering data somehow!

I want to be able to add and remove required fields in the SQLServer rather than having to touch the ASP code. I don't want to add a constraint to each field name in everytable! (over 350 fields and counting).

If this make any sense, has anyone done or tried this?




Carolus Holman

Reply to this topic