You don't need any code at all (not really). Just include the SLX_Common script into your code and use:
<p>OpenMainViewFromGridCrntID grdContacts, "CONTACTID", "System:Contact Details", 1, True 'DNL
For example. This will take whatever item is highlighted on grdContacts - then open the contact details main view and set it to this contact (opening it, if it's not already open). Or, if this isn't a grid, you can do the same:
Dim objMainView<br /> Set objMainView = Application.MainViews.AddEx("System:Opportunity - Quote Details", 1, True, 1, dgQuotes.GetCurrentField("A2_OPPORTUNITYID"), "") 'DNL
So, this simply takes the view and the ID and moves to the view (again, opening it if required). Beware also - this is the MAIN VIEW NAME (Contact DetailS) - not the form Contact Detail. It needs to be the main view name and the MV itself will have a reference to the view to display (plus tabs etc).
|