B
bhammer
Access2003
Why can't I do this with SetFocus?
Two forms are opened and maximized (using the handy module alxmdlReports
that I modified to work with forms, too). My toolbar has buttons to open both
forms. Once the forms are opened, I want them to work like the
Windows>ActiveWindow menu, or like ALT+TAB to toggle between opened windows,
switching the 'back' window to the 'front'.
I have code on the toolbar button that checks for IsLoaded (myForm) = True
If the form is already loaded, then just make active the other form.
SetFocus seems to do nothing.
Here's the code I have in a Module in the Function behind the button to open
(or goto) the frmByAddress form:
Public Function fOpenfrmByAddress()
Dim strDocName As String
strDocName = "frmByAddress"
If IsLoaded(strDocName) Then
MsgBox "Yes, " & strDocName & " IsLoaded.", , "fOpenfrmByAddress"
Forms.frmByAddress.SetFocus
Else
DoCmd.OpenForm strDocName
alxMaxForm 0, strDocName
End If
Shouldn't this work?
Why can't I do this with SetFocus?
Two forms are opened and maximized (using the handy module alxmdlReports
that I modified to work with forms, too). My toolbar has buttons to open both
forms. Once the forms are opened, I want them to work like the
Windows>ActiveWindow menu, or like ALT+TAB to toggle between opened windows,
switching the 'back' window to the 'front'.
I have code on the toolbar button that checks for IsLoaded (myForm) = True
If the form is already loaded, then just make active the other form.
SetFocus seems to do nothing.
Here's the code I have in a Module in the Function behind the button to open
(or goto) the frmByAddress form:
Public Function fOpenfrmByAddress()
Dim strDocName As String
strDocName = "frmByAddress"
If IsLoaded(strDocName) Then
MsgBox "Yes, " & strDocName & " IsLoaded.", , "fOpenfrmByAddress"
Forms.frmByAddress.SetFocus
Else
DoCmd.OpenForm strDocName
alxMaxForm 0, strDocName
End If
Shouldn't this work?