Form and subform

wannabepro

Registered User.
Local time
Yesterday, 21:44
Joined
Jan 25, 2005
Messages
102
I am creating a Financial Statement database and I am done with most of the stuff. Except for one thing that is holding me back, that is there are four columns and these four column has Rent info, monthly rent, yearly rent and share of rent. Since, these column would have as many rows as user wants. Now, my question is, since these ppl wont use this form on every day basis nor the information on these columns would be same. How can I add this form to other mainform (should I add it as a subform, but how can I get rid of the previous record data), and how can it hold the info on just one record, while keeping all the fields empty on the other records, unless user chose to input info in it. If I add this as a sub form, it will show the all the info over and over again from previous record. I made a form and added it to as a subform, but now I am realizing my mistake. I don't want to create several text boxes so the user can input info, and that would be unprofessional. I am not sure if there is any other way, i tried exporting excel sheet but that didn't work either.

Originally, this was created in excel; however, my boss asked me if this can be done in ms access and I am giving it a try, and so far its been a smooth ride. But, this is the only thing that is making it hard.

I hope, I am making sense and you guys will be able to help me out in it.

Thanx in adv.
 
Last edited:
Actually, there is a pretty easy decision here.

If you have a situation in which you have two tables participating in a many-to-one declared relationship, it correlates extremely well to a form/subform situation. So for example, if you have a single client and many rent records, there's your situation.

Now, to make this work, you make the "one" side of the relationship the main form. The "many" side is the subform. But here you need to use the OTHER nomenclature - this is called parent/child forms, too. And the key property you need to know uses this nomenclature.

On the main form you build a subform CONTROL and insert the actual subform into that control. The subform CONTROL is just a placeholder for the real form - but it is also a visual design aid since you can see where it goes - and where you can't put anything 'cause the child form will overlay it once that form pops into place.

But HOW do you relate the parent and child? Well, bless you, m'lad, it's easy. As properties of the subform CONTROL (i.e. residing on the main form), there are a couple of properties called the parent and child links. These are the names of the fields in the parent form and the child form that correspond to the participants in the many-to-one relationship that links the involved tables. And you REALLY DO need to have that relationship expressed explicitly as a formal i.e. declared relationship.

Read up on parent/child or main/sub form issues. It really isn't that hard and if you get the linkages right, it is almost seamlessly automatic. Just remember to use DECLARED relationships as the basis for your form and subform relationships. If you do, you got it sacked, my friend.

The down side: If the child records are ARBITRARY i.e. not part of a declared relationship, what you wanted to do just got inordinately hard. Access is not a mind-reader. You have to give it something concrete to work on. That's why the emphasis on declared relationships.
 

Users who are viewing this thread

Back
Top Bottom