13 replies
by ravi
You can put code in the "After Update" event properties for the field in question to open the second form: DoCmd.Openform "Form Name".
However, it seems to me that you need a form/subform kind of set-up, especially if there is a common field between the two forms and the data involved are in two different tables. I am afraid you haven't given enough details to comment further.
by mncurrr
by mcse lee
by mncurrr
by r.m.stimpson
by mncurrr
by jan d
by mncurrr
by nettech
by mncurrr
by mbarker734
Assuming the underlying table for your second form is already populated with the company id, place the following code into your desired event (i.e. On Click, On Dbl Click etc.). The example show is how the On Double Click Event Procedure would appear for the CompanyID field, less ofcourse your naming conventions for the forms and fields. You could if you wanted apply the main body of the code to a command button.
Private Sub CompanyID_DblClick(Cancel As Integer)
On Error GoTo Err_CompanyID_DblClick
Dim DocName As String
Dim LinkCriteria As String
DocName = "frmCompanyForm2"
LinkCriteria = "[CompanyID] = Forms![frmComapnyForm1]![CompanyID]"
DoCmd.OpenForm DocName, , , LinkCriteria
Exit_CompanyID_DblClick:
Exit Sub
Err_CompanyID_DblClick:
MsgBox Error$
Resume Exit_CompanyID_DblClick
End Sub
Hope this helps.....
by mncurrr
by mncurrr
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending