Add Field to Form/subform?

cindyareed

Registered User.
Local time
Today, 18:38
Joined
Mar 11, 2002
Messages
29
I have 4 form/subforms that I want to add a field to. The field is in a different table than the 2 tables currently being used. How can I add this new field to the existing form with out starting over?

Ultimately what I would like to do is force a value into this new field based on which set of forms the user is in.

Thanks in advance for help

Cindy
 
This may not answer your question but if you base a form on a query, you can include fields from any of your tables (provided that the relationships are correct to get accurate information). You say you 'would like to do is force a value into this new field based on which set of forms the user is in' To me this implies that you are using the same form with different data sources to pouplate the tables.Is this correct?
HTH
 
I have the following:
1. Parent information and student info in the subform.

2. Grandparent info and student info in the subform.

3. Child info and parent info in the subform.

4. Child info and Grandparent info in the subform.

They are all different forms/subform.

I have a table that links the children to the Parents and grandparents. What I want to do is force a value into this linking table based on the form the user is in.

IE: if in forms 1 or 3 I want to force one value into the linking table when a record is created. If in forms 2 or 4 I want to force a different value into to that linking table.

Cindy
 
I presume you mean on a new record?
If so, add a textbox control (hidden if you want) bound to the field you want to update on each of the forms then set its default value to what you want. I'm not quite sure if this is what you want though.
 
Fizzio,

Can I add a text box for a field that is not on the form and not in either the parent/grandparent or child table?

The field I want to update is in the Relations table.

PARENT RELATIONS CHILD
ParID ---------> RelAdult |---> ChildID
other info RelChild ----| othinfo
RelRelTyp

When I create a new record in the child or parent table the RelAdult and RelChild get populated correctly (because of the relationship that links them together) but the RelRelTyp field gets the default I have set up on the RELATIONS Table. I want to force the value to be parent if in form 1 or 3 and Grandparent if on form 2 or 4. Can I do that with a text control box? It seems like I could if I can add a table and the field to the form.

Is there a way to add a new table to an existing form with out having to recreate the form?

Thanks Cindy

[This message has been edited by cindyareed (edited 04-04-2002).]
 
Well the relationships above are unreadable as they have shifted around so here it is again.

PARENT
ParID (PK)
otherinfo

RELATIVE
RelParID (PK)
RelChdID (PK)
RelTyp

CHILD
ChildID
other info

The ParID is linked to RelParId and ChildID is linked to RelChdID.

Cindy
 
Rather than basing each form on a table, base the form on a query. This wa you can add any field to the query from any table and it will become available to the form. If you want to set a default value according to which form you are in, do not set the default value at table level, instead set the default value at form level therefore each form can have a different default value for the same field.
It seems that you are duplicating controls into 4 forms which may not be the most efficient way. Look at using queries for the form datasource instead. Hope this helps
 
Fizzio,

Thanks for your recomendation about using queries instead of tables to create forms. I have changed my approach and am getting closes to what I expect.

I was wondering if there is a way to have a form and "toggle" between two subforms. I have created a Student form and have the parent subform attached to it (forgive me if I am not using the correct phraseology) but would like to beable to also have the grandparent set up as a subform but not have the parent and the grandparent subforms displaying at the same time.

I am new to Access (as if that wasn't clear already!) and don't know what the limitations are, but it seems like this should be do-able.

Thanks for your help
Cindy
 
The best way to only show one subform at a time is to use a tab control. These are just tabs that when selected, only show the controls / subforms placed on that tab. In the objects toolbar, there will be one that looks like two tabs. Place this on your main form then add each subform to the respective tab form (Make sure that when you drag the subform onto the tab that it selects the whole of the tab ie goes dark) then select the other one and place your other subform. The links will remain the same.
HTH
 
I have tried numerous times and ways to place my subform to a tab but the tab never goes dark.

What am I doing wrong?

Thanks
Cindy
 
It does not stay dark. I've just remembered (oops) that drag and drop does not always work! Cut the subform, select the tab (so that the markers inside the tab form are displayed) and paste the subform in there.
That should work - sorry for leading you up the garden path
 
I had this problem a while ago.

I did this:

In the on_click event of a button, text field or what ever you want, put:

Me.nameofcontrol.sourceobject="nameofsubform"

This will change the subform. To change it back, use the same syntax but a different "nameofsubform".

Also, Pat Hartman suggested you could make one subform visible and the other invisisble on clicking the button, text box or whatever.

Fuga.
 

Users who are viewing this thread

Back
Top Bottom