[AccessD] Transactions

Gmail max.wanadoo at gmail.com
Thu Sep 6 15:19:48 CDT 2007


Hi Drew,
Some code from Dev Ashish (below) might do the trick.
Regards
Max

Option Compare Database
Option Explicit

' API: Manipulate Access Window
' Author (s)
'Dev Ashish
'
'
'(Q)    How do I maximize or minimize the main Access Window from code?
'
'(A)    Pass one of the declared constants to the function fSetAccessWindow.
'
'This same function can also be used to completely hide Access window and
just show your form on the desktop.
'Make the form popup and from it's Open Event, call the fSetAccessWindow
function with SW_HIDE as the argument.
'
'Warning:    If you're hiding the main Access window,  make sure your error
handlers are good.
'Because with the window hidden, if an error is raised, pressing "End" on
the Error window will NOT make Access window
'visible and you will be left with just the form open.
'A recommended method is to make a call to fSetAccessWindow with
SW_SHOWNORMAL from your error handlers.
'    If,  for some reason, the Access window does not show itself,  then you
can always close the mdb from the Task List, available in Win 95 with
Control-Alt-Delete (once) and under NT, by right clicking on the Taskbar and
selecting Task Manager, by selecting the mdb and clicking End Task.

'************ Code Start **********
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
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


 
  

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Thursday, September 06, 2007 8:56 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Transactions

Show me a way to truly prevent it.  It's there whether you like it or not.
Disable the Access Keys such as F11, and you just have to go through the
Window Menu.  Even hiding the Access Window itself doesn't guarantee a
curious user can't get to the database window.  Heck, the code to unhide
every Access window on your machine is just a few lines.

User level security isn't hack proof (nothing is), but it is a lot stronger
then 'hiding' the database window.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel
Sent: Thursday, September 06, 2007 2:42 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Transactions

Drew,

Do you really allow users access to the Database Window?

Regards
Steve

Drew Wutka wrote:
> Access User Level security.
> 
> It all depends on how you want to do things.
> 
> I have several .mdb's on our network that are setup somewhat like
this.
> 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com The information contained in this
transmission is intended only for the person or entity to which it is
addressed and may contain II-VI Proprietary and/or II-VI BusinessSensitve
material. If you are not the intended recipient, please contact the sender
immediately and destroy the material in its entirety, whether electronic or
hard copy. You are notified that any review, retransmission, copying,
disclosure, dissemination, or other use of, or taking of any action in
reliance upon this information by persons or entities other than the
intended recipient is prohibited.


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list