To fire Double Click event of Subform from Main Form

Savita

Registered User.
Local time
Today, 11:24
Joined
Sep 1, 2007
Messages
14
Hi,

I have a subform in datasheet layout embedded in the main form.I want to invoke a procedure on the double click of each record in the subform.Is there a away by which I can achieve this?Is there a way by which I can fire the double click event of Detail section of the subform from the main form?I can't find this event.

As of now,I am invoking the procedure in the Form_DblClick event of the subform.But this invokes the procedure when I double click on any part of the subform.I want to invoke it only on the double click of records in the subform.Pls help.

I don't want to open the subform in a new window.It is embedded in the main form.

Thanks,
Savita
 
Last edited:
Assuming you want to use one generic routine as the double-click, regardless of which record they are on, you direct the double-click event of each field in your subform to a custom subroutine, like so:

Code:
Private Field1_DblClick(Cancel As Integer)
    Call YourCustomSubroutine
End Sub

Private Field2_DblClick(Cancel As Integer)
    Call YourCustomSubroutine
End Sub

And so on. Then the separate subroutine (YourCustomSubroutine) handles any of the double clicks on any field in any record. You can query the SubForm to get the record that was clicked using the CurrentRecord property of the subform's recordset.
 
I put the double click on the Form itself rather than the Detail. This works for both a Datasheet a Datasheet Form contained on a Subform. This does not seem logical to me but it works.

Simon
 

Users who are viewing this thread

Back
Top Bottom