Add record in a sub form from the main form!

hardy1976

Still learning...
Local time
Today, 14:55
Joined
Apr 27, 2006
Messages
200
Hi

I'm trying to create a record in a sub form from the main form, but just cannot get it to work!

any ideas how I do this?

thanks
H
 
Do you have the Master & Child links set up in your subform?
 
Yes I do, Both from the Main to the sub and from the sub to the sub!

Its the third form that I want to add a record to from the main form.

Form_Main
Form_Sub1
Form_Sub1_SubForm

Help would be much appreciated.
 
It's a bit hard to answer your post when you don't state that you have a Main form with 2 subforms.

Have a look at my sample, it may help you with your problem.

Click Here
 
sorry, thanks for the post, but I dont think I'm describing my problem clearly.

I have a main form in which I have a sub form, within this sub form I have another sub form. What I want to do is have a button on the main form wich created a record in the sub-sub form.

If the main form was level 1 and the sub form level 2 and the sub sub form level 3, it means I want a button on level 1 that will create a record in level 3.

Hope that makes sense!
H
 
I am no Access guru, however I would say you can't The Main Form has a 1-Many relationship with the SubForm1. SubForm1 has a 1-Many relationship with subform2.

Each record in the Main form can have many related records in SubForm1 and for each record in Subform1 there can be many related records in SubForm2.

If you have a look at my sample, there is no direct link between Subform2 and the Main form.

Someone else may post a solution for you and we will both learn something.

Sorry I could not solve it for you, also I understood you last post perfectly.
 
how about changing the record source of the first sub-form to a query that relates to the 3rd form. you could change it when the 1st subform gets the focus, loaded etc. you can jump through subforms by this method and changing the record source.
 
im just going to keep throwing suggestions your way till i run out.
how about having your button directly manipulate the table/query the subform is based on? or set your sub-sub forms source to a query which manipulates fields in the subform?
 
thanks for the ideas, I will give a go in the morning and let you know
 
I think you could do this by running an append query, using the key value (parent value) of the current record in the level 2 form to fill the appropriate child value in the table supporting the level 3 form, and supplying whatever other info you need either with fields or in the query. The danger is that you have to have the correct record selected in the level 2 form, or the button will append the wrong information to the table. After the append, have the code refresh the query on which the level 3 from is based.

Matt
 

Users who are viewing this thread

Back
Top Bottom