View Full Version : Can't access the proper records on a form


imran
07-27-2000, 07:45 AM
I have cretaed a form. THe main form has information on an organization while there is a subform which lists all the resources that the organization has to offer.
What I need to do, is be able to double click any entry on the subform (resource materials) and have it display a new form which has more in depth information on the resources.

How would I do that. I know it's possible since i've seen it but I just can't figure it out. Thanx.

Rich@ITTC
07-27-2000, 08:29 AM
Hi Imran

You will need to set up some code to run behind the subform. For each text box add the following to On Dbl_Click

Private Sub txtFieldName_DblClick(Cancel As Integer)
On Error GoTo Err_txtFieldName_DblClick

Dim DocName As String
Dim LinkCriteria As String

DocName = "frmYourNewForm"
LinkCriteria = "[RecordID]= Forms![frmExistingForm]![frmExistingFormSub].Form![RecordID]"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_txtFieldName_DblClick:
Exit Sub

Err_txtFieldName_DblClick:
MsgBox Error$
Resume Exit_txtFieldName_DblClick
End Sub

That should do the trick!



[This message has been edited by Rich@ITTC (edited 07-27-2000).]