Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Form jumps from one screen to another?

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
There is a user who has 2 monitors on his desktop. He'll drag the access app (form) to one of the monitors. If he makes any selection on that form, the access form then jumps back to the first monitor he had it on...make sense? If so, how is this prevented? Or is this a user computer issue?

Thanks.
 
It sounds like a video control problem. I am using UltraMon and have seen some strange things happen. I will watch for other comments and see if anyone has a better explanation.
djj
 
Thanks. It's a dual monitor setup he has, but from what I hear and see, it's one laptop connected to both monitors. So it shouldn't make much difference I would think...
 
check for any move/size code in the form. could be an after update or just (form) activate or ... but could easily be programmed into ...



MichaelRed


 
The only "size" code I use is:

fAccessWindow "Minimize", False, False

And that is to just minimize access so no one can get to the tables when it's opened. I wonder if when it is opened from Monitor "B", and then a record is changed, maybe it jumps back to "A" because that is where it was originally opened from...? But it's the same CPU with Dual Monitors.
 
... but what does fAccess Window refer to? Mayhap posting this function would provide some insight.

Also, I more commonly use the Hide method for the dbWindow, when either attemptiing to deny access to MS database objects (then I also use a custom menu to omit the hide/unhide menu options) or just to minimize the screen clutter.

MichaelRed


 
Here is the function code:

Option Explicit

Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long

Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function



-----could you post what you were talking about with hiding the form / restricting access? maybe that would work for me instead of this...?
 
the code below is taken from long away and far ago. it is 'simplistic' in most every sense of the word. the menu designation is surely different in ver 2007, so you should check this thourghly. I do not have time to disentangle the custom menu form the midst of the procedure and make it clear, but there are many custiom menus available thru these fora and that part has probably changes more than the hide / unhide.

Code:
Public Sub HideDatabaseWindow(fHide As Boolean)

  'Comments  : Hides or shows the database window
  'Parameters: fHide - true to hide the database window, false to un-hide it
  'Returns   : Nothing

  Const cdmiForm = 0
  Const cdmiWindow = 4
  Const cdmiHide = 3
  Const cdmiUnHide = 4

  On Error GoTo PROC_ERR

  ' Move focus to the window
  DoCmd.SelectObject acTable, "", True

  ' Use the window menu to hide or show the database window
  If fHide Then
    DoCmd.DoMenuItem cdmiForm, cdmiWindow, cdmiHide, , acMenuVer20
  Else
    'Turn off error handling to account for  form sequencing issues
    
    On Error Resume Next
    DoCmd.DoMenuItem cdmiForm, cdmiWindow, cdmiUnHide, , acMenuVer20
    On Error GoTo PROC_ERR
  End If

PROC_EXIT:
  Exit Sub

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
         "HideDatabaseWindow"
  Resume PROC_EXIT

End Sub

I will look at your code later / tomorrow



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top