Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005

    Unanswered: Can you only show form not access?

    Is there any way to only show the access form and not access itself? and if they close the form it then also closes access because you don't see it. I don't know if this is posible. This is just for screen management. we work on multiple applications at the same time and my form only takes half the screen and want them to see the other half. Thanks for your help.


  2. #2
    Join Date
    Feb 2004
    One Flump in One Place

    I can't remember how (if?) you can do that. However you can avoid it by sizing and positioning the access window itself. I can't remember where I got this code but it is from the web somewhere. I'll see if I can get the info to credit the author.

    Module #1:
    Declare Function WM_apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Declare Function WM_apiSetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Module #2
    Global Const WM_SW_RESTORE = 9
    Global Const WM_SWP_NOZORDER = &H4
    Global Const WM_SWP_SHOWWINDOW = &H40
    Sub xg_SizeWindow(sWindow As String, X As Integer, Y As Integer, cx As Integer, cy As Integer)
    ' Size the active form window, or the main Access window.
    ' Parameter sWindow:  "Active" - Size the active form window.
    '                     "Access" - Size the main Access window.
    '                 x:  left boundary for window (pixels)
    '                 y:  top boundary for window
    '                cx:  width of window
    '                cy:  height of window
    Dim iRtn As Integer
    Dim hWndSize As Long
    Dim strProcName As String
    On Error Resume Next
    strProcName = "xg_SizeWindow"
    If sWindow = "Active" Then
        hWndSize = Screen.ActiveForm.hwnd
        If Err <> 0 Then
            'xg_ErrorMessage strProcName & " (1)"
            GoTo Exit_Section
        End If
    ElseIf sWindow = "Access" Then
        hWndSize = xg_GetAccesshWnd()
        MsgBox "Invalid parameter passed to xg_SizeWindow = " & sWindow
        Exit Sub
    End If
    iRtn = WM_apiShowWindow(hWndSize, WM_SW_RESTORE)
    Call WM_apiSetWindowPos(hWndSize, 0, X, Y, cx, cy, WM_SWP_NOZORDER Or WM_SWP_SHOWWINDOW)
    If Err <> 0 Then
        'xg_ErrorMessage strProcName & " (2)"
    End If
    End Sub
    Function xg_GetAccesshWnd() As Long
    'Returns a handle to the main Access window
    xg_GetAccesshWnd = Application.hWndAccessApp
    End Function
    'Change these values to suit you. Note - I have a widescreen lappy so these values might look really odd for you.
    Public Sub SizeWindow()
    Dim X As Integer, Y As Integer, cx As Integer, cy As Integer
    X = 800
    Y = 0
    cx = 485
    cy = 770
    xg_SizeWindow "Access", X, Y, cx, cy
    End Sub
    When your start form loads just call size window.

    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts