Double Click subform dataview record to add to second subform

NotAnExpert

Registered User.
Local time
Today, 10:10
Joined
Feb 3, 2017
Messages
46
Hi all.

I have a parent form with two sub-forms on it. The first sub-form is filtered by selection on parent form. However what I want to do is double click the record in the first sub-form which will then populate an entry in the second sub-form. If I double click again on the first sub-form I would like it to add a second record to the second sub-form.

I know this is possible but i'm not sure of the process to follow to make it work.

Could someone more knowledgeable point me in the right direction or a nod to an example would be awesome.

Thank you all.
 
you add a Code to the field/fields, Dbl
Code:
private sub field_DblClick()
With Me!secondSubForm.Form.Recordset
    .AddNew
    !FieldOnSubform2 = Me!fieldOnSubform1
    !anotherFieldOnSubform2 = Me!anotherFieldOnSubForm1
    .Update
End With
end sub
Click Event on the first subform.
 
Why are you duplicating the data? What happens if the user selects the same record from sf1 more than once? Will multiple copies end up in the table of sf2?
Hi Pat, thanks for asking. The original data sits on SQL Server, but I need to be able to duplicate very specific information from this database into Access for an entirely separate purpose.

With regards to record duplication, yes, certain records will have multiple entries against it i.e. material/batch references
 
Last edited:
I think it might be best if I try to explain a little better. As i'm not sure the references look right to what I need...

I have a main form and that mainform contains two separate subforms. Both subforms are linked to the mainform by an ID.
The first subform gets data from SQL Server table, and the second subform is where I want to duplicate the data with extra bits.

I want to double click a record on the first subform, and some of that data appear in the second subform.

These subforms are not nested into each other and are completely separate.

Hope that helps!
 

Users who are viewing this thread

Back
Top Bottom