Ok, there are three things that this form does (code wise). They are listed below with a brief explanation above them and split into two parts, whats in the module and whats in the "On" Event in the form itself.
#1 Minimize Access Window: This code minimizes the Access window so only the form displays on the desktop:
Module:
-------------------------------------
*******************************Code:Option Compare Database Option Explicit Global Const SW_HIDE = 0 Global Const SW_SHOWNORMAL = 1 Global Const SW_SHOWMINIMIZED = 2 Global Const SW_SHOWMAXIMIZED = 3 Private Declare Function apiShowWindow Lib "user32" _ Alias "ShowWindow" (ByVal hwnd As Long, _ ByVal nCmdShow As Long) As Long Function fSetAccessWindow(nCmdShow As Long) 'Usage Examples 'Maximize window: ' ?fSetAccessWindow(SW_SHOWMAXIMIZED) 'Minimize window: ' ?fSetAccessWindow (SW_SHOWMINIMIZED) 'Hide window: ' ?fSetAccessWindow (SW_HIDE) 'Normal window: ' ?fSetAccessWindow(SW_SHOWNORMAL) ' Dim loX As Long Dim loForm As Form On Error Resume Next Set loForm = Screen.ActiveForm If Err <> 0 Then 'no Activeform If nCmdShow = SW_HIDE Then MsgBox "Cannot hide Access unless " _ & "a form is on screen" Else loX = apiShowWindow(hWndAccessApp, nCmdShow) Err.Clear End If Else If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then MsgBox "Cannot minimize Access with " _ & (loForm.Caption + " ") _ & "form on screen" ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then MsgBox "Cannot hide Access with " _ & (loForm.Caption + " ") _ & "form on screen" Else loX = apiShowWindow(hWndAccessApp, nCmdShow) End If End If fSetAccessWindow = (loX <> 0) End Function
OnOpen Event in form:
-------------------------------
#2 Specify location on screen: This tells access what size the form should be and where it should be located on the screen (set for bottom right hand corner at 1024x768 right now.Code:Private Sub Form_Open(Cancel As Integer) fSetAccessWindow (SW_SHOWMINIMIZED) End Sub
In Module:
-------------------------
**********************Code:Option Compare Database Option Explicit Declare Function MoveWindow Lib "user32" _ (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth _ As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
OnLoad Event in form:
----------------------
#3 is the one you just help me setup and the code is listed above.Code:Private Sub Form_Load() Call MoveWindow(Me.hwnd, 630, 630, 400, 100, 1) End Sub
I think where the difference in our setups and why mine is not working is that the access window is minimized to the task bar on mine and the only visible thing from access is the small form itself. Maybe what I want to do cannot be done. Let me know what your outcome is.
Jim
Also if you need me to send you the dBase itself let me know it is very small right now.




Reply With Quote