Subform Link field

Posted on 2016-10-16
Medium Priority
Last Modified: 2016-10-17
I have a main form (Table "A") with a command button that opens form "Sets"(Table "Sets"). When a new record is created in the main form I want to be sure that the "Sets" form has a corresponding and linked record even when the form has not been opened.

The linking field between the forms is ItemNumber. So in the past I have used

"If IsNull(Form![Sets].ItemNumber) Then "Sets" form!Sets.ItemNumber =MainForm.ItemNumber"

I am sure that this will not work if the form is closed but I don't want the user to have to open the form or program an open and close procedure.

Is there something in access like ""Always create a record in the "Sets" table where Table "A" has a record

Or would that happen naturally if the tables are linked on a 1 to 1 basis
Question by:DatabaseDek
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
LVL 17

Expert Comment

by:John Tsioumpris
ID: 41845614
If you put Sets as a subform and link it to TableA...everytime you have a new record on form(tableA) you will get a corresponding record on Sets...
LVL 21
ID: 41845689
if the tables are 1:1 and you always create a record in the second table, why not just put all the fields in table "A"?

Author Comment

ID: 41845822
Crystal my life is never that simple. I already have 210 fields in Table "A" It cannot be any more normalised. I have to close and open because I am bumping up against the 2048 max links with Access. Often the Sets form is just not required. But if I don't have a number in the linked field it causes problems elsewhere.

It just seems daft that you have to force a link.

Hi John
The link in a subform only happens when data is put on the subform (as far as I am aware). As I say I don't want to force an entry because any sensible user will ask why.
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

LVL 21
ID: 41845824
210 fields! A well designed database will usually have less than 20 fields in a table, with some exceptions such as Orders that record point-in-time values.
What is the database for?

Author Comment

ID: 41845918
The specification of fire doors
LVL 21
ID: 41845927
I don't see a couple hundred fields ...

Each of the panels should be in a related table with dimensions relative to your origin.  However, you probably make other types of doors and even fire doors might look different.  It would be best to see what is in common and break down information so that you can set up tables to define each door type and then equations to render it since people might get a door that is 8' tall or 7' tall or 3' wide or 2'10" wide, etc

You should have several tables.

What is the purpose of the database? to store specs for drawing? for making? for cutting pieces?

Author Comment

ID: 41846478
Hi Crystal

The purpose is all of that. A lot of information is hidden and yet more are in invisible subforms. Here is the input form. I know that it is complex but I will not have my users constantly opening and closing forms. Almost Everything here that describes the product is visible to the operator. So if a customer calls with an inquiry it can be seen immediately.  Also when something is changed I.e. the door width everything related to that has to change automatically so I would have to open a form do a separate calculation and paste it into the table. Everything here is calculated by the underlying query or background code
LVL 17

Assisted Solution

by:John Tsioumpris
John Tsioumpris earned 600 total points
ID: 41846515
Thats the same issue i am facing since i have inherited a similar case...
Normalization is Normalization and no matter what you have to change the Structure of your Tables....
A long time ago i have also tried to change it but i hit a brick wall....NOT my fault and lets say there is a lot more....
You have to think totally differently...and think on the basis of element - attribute-value...
IT would make a tremendous impact on your database when everything just gets positioned as they should be.....
But probably this is another brick wall....
By the way i am also on the same job....and i mean the same...:)
LVL 21
ID: 41846801
while I can understand you wanting to see everything on one form ... did you know that a form can be ON another form? It is called a subform when it is used for that purpose.

As an example, you have provisioned for up to 6 vision panels ... what if they want 8? Do you plan to add more fields? I see that you should have a related table for panels.  It could be designed as a continuous form and show however few, or however many, panels there are.  Right away, this would get rid of a bunch of fields in table "A" and move them to where they belong.

here is a short book with lots of screenshots you can read:

Access Basics

the basics don't change

Author Comment

ID: 41846840
The vision panel detail is actually a subform without borders and there are 6 more not visable. I have never seen a doors with more than 6 vision panels in each door.

Hi Crystal

The reason I don't use a continuous form is because if you look at the first numeric box it is entitled DFT (Down From Top of door. The starting point for the first vision panel) the next to the right is BVP (Between the first vision panel and the next) If I had a continuous form it would read DFT which means the user would have to calculate the new distance from the top including the first vision panel and the gap between the two. When you get to the sixth VP that's not so easy. When the information received from THEIR customer would read "Between Vision Panel". My philosophy has always been "make Access work hard, not the customer"

Hi John

Is your problem a product orientated DB as well?

To fully describe a door set you need the equivalent to 500+ fields. I started this 10 years ago and have to accept some bad practice. But I thought a database was supposed to have one table per subject. 500 fields is one subject. I am sure you are both right but I need a simple answer to the question can it be done do you think?
LVL 21

Accepted Solution

crystal (strive4peace) - Microsoft MVP, Access earned 1400 total points
ID: 41846867
> "When you get to the sixth VP that's not so easy."

The VPs could be numbered. Perhaps you want to enter relative distances ... and then behind the scenes they could be added up when required.  Just giving you ideas as you know your business much better than me; I am giving you my best guesses because I know Access.

> "thought a database was supposed to have one table per subject"

one table per noun, and items need to be stored distinctly. A door is a big subject. It is composed of many other parts.  Each of those part types might need their own tables which have records related to a specific type of door.

It can be done, of course. You have already given this a lot of thought ... now it is just a matter of changing your perspective

Author Closing Comment

ID: 41846981
My thanks to you both.

John How are you remedying the situation.
LVL 21
ID: 41847003
you're welcome ~ happy to help

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question