Subform Link field

Posted on 2016-10-16
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 16

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 20
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.
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

LVL 20
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 20
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 16

Assisted Solution

by:John Tsioumpris
John Tsioumpris earned 150 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 20
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 20

Accepted Solution

crystal (strive4peace) - Microsoft MVP, Access earned 350 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 20
ID: 41847003
you're welcome ~ happy to help

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

730 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