Problem with data entry in linked subforms

spikey

New member
Local time
Today, 23:50
Joined
Jan 27, 2004
Messages
9
Hi,

I created a main and subform with a formwizard with data from two tables. For example as a main form a contactperson with a linked subform with his adress(es). The problem lies within data-entry: when i enter new data in de contactperson form automatically a new contactpersonID is created. But when i click the linkbutton (togglelink) and insert, in de linked subform, some adress data, the foreign key (contactperson) isn't filled in automatically, it isn't even recognized. The same counts for adding new adress to an existing contactperson(ID): in the (filtered) subform the foreign key in the table is still zero. So one: the linkbutton to the subform doesn't save new records in the main form and two: the foreign key isnt automitacally updated.

I find this strange because when i use the same formwizard but instead create a main form with a nested subform then it works fine. I checked my relations between the tabels contacperson and adresses: They are one-to-many linked via ContactpersonsID integrity and all casacede options on. Can anyone help me with this problem, i dont have visual basic experience so i hope there is an alternative.

Greetings Tim
 
What is the Parent/Child Relationship set to on the subform (You can see this when you have the Parent/Main form open and you select the subform object)
 
thans for your reaction, im new here:)

I cannot find this relationship, the only object that refers to the subform is the togglelink. The formwizard created this one autmatically.

When i insert a subform manually in the desigview of the main form then i can set the parent/child relationship (in my case both contactpersonID). Then all linked fields for that selection are automatically filled in properly. But then i have a nested subform. And what i want is to access this subform via a button.
 
Then you will need to Add Code to the Before_Insert Event of the Sub Form and reference the fields from you "Parent Form" to fill in the fields on this "Pop-Up" Entry Form.

Example
Me = the Current Form Object
Code:
Sub Form_BeforeInsert(Cancel as integer)
Me.[Popup Forms Field Name]=Forms![Parent Form Name].[FieldName]
End Sub
 
It works!

Thanx!!!! You helped me a lot.

Greetings Tim
 

Users who are viewing this thread

Back
Top Bottom