|
Brian,
For ensuring that documents opened by clicking
a hyperlink control on the form, get displayed in maximized state, we have
to allow for the time delay involved in activation and stabilization of the
target document.
When FollowHyperlink method of access
application, based upon path of target document is used (instead of
direct hyperlink), the required time lag can be accommodated in the
click event itself, using a suitable time delay loop incorporating
WithEvents statement.
The alternative mentioned in previous para is not
available when clicking hyperlink type control. Execution of code in click
event precedes activation of hyperlink. In such a situation, the desired
objective can be achieved by transient activation / de-activation of form's
timer. Sample code for form's module, as given below, should get you the
desired results.
It may please be ensured that [Event Procedure] appears
on Event tab of the properties dialog box of the form (against the item: On
Tmer) as well as TxtLinkDoc (against the item: On Click).
Best wishes,
A.D.Tejpal
Form's VBA Module
(TxtLinkDoc is the name of hyperlink type control)
====================================
' General Declarations Section
' Global variables
Private Hwd As Long, TotTime As Long
' Set max limit for time out = 10 seconds Private Const MaxTime As Long = 10000 ' API
declarations
Private Declare Function GetForegroundWindow _
Lib "user32" () As Long
Private Declare Function ShowWindow _
Lib
"user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
----------------------------------------------------------------
Private Sub Form_Timer()
Dim HwDoc As Long TotTime = TotTime + Me.TimerInterval If TotTime > MaxTime Then ' Time out Me.TimerInterval = 0 Exit Sub End If HwDoc = GetForegroundWindow() If HwDoc <> Hwd Then ShowWindow HwDoc, 3 ' 3 for maximized state Me.TimerInterval = 0 End If End Sub Private Sub TxtLinkDoc_Click()
TotTime = 0 Hwd = Application.hWndAccessApp Me.TimerInterval = 200 End Sub ====================================
Please zip all files prior to uploading to Files section. Yahoo! Groups Links
|
