User and CloseButton - RE: 
Author Message
 User and CloseButton - RE:

Hi Dev,

Thank you for tanking time to answering, but how can I trap this
information.
The for is a menu thats means that I have some code in the CoseEvent, which
comes after the UnloadEvent.

That means if the I have to put some code in the UnloadEvent that will
"disable" all the other events on the form. Do you get the point.

A little extra question

What is wrong with this code:

If CurrentUser = "Supervisor" Then
...then do something
Else
....then do something else
end if

and what a wonderfull place this Dev's World in {*filter*}Space
http://www.*-*-*.com/ ~dashish

Thanks in advance

Mik

Quote:
>Hi Mik,
>Put code behind the form's Unload event.  You should be able to trap it
from
>here, and set to Cancel if needed,

--
Mik Achton-Boel



Mon, 08 Jan 2001 03:00:00 GMT  
 User and CloseButton - RE:
Hi again,

I have made the code below to check who is opening the database.
If it is the Owner he/she have AllPermission

As you can see the AllPermission returns a number. And my question
is can I be sure it allways the same number, and is this
a good way to check the owner off the database?

And Hi Dev if you see this messages,

"Concerning CloseWindowButton"

Thank you for tanking time to answering, but how can I trap this
information.

The for is a menu thats means that I have some code in the CoseEvent, which
comes after the UnloadEvent.

That means if the I have to put some code in the UnloadEvent that will
"disable" all the other events on the form. Do you get the point.

'**************************************Code
Begin**************************************

    DBEngine.SystemDB = "system.mdw"

    Dim dbs As Database
    Dim ctr As Container

    Set dbs = CurrentDb
    Set ctr = dbs.Containers!Databases

    Debug.Print "Container: " & ctr.Name
'Just a check
    Debug.Print "User: " & ctr.UserName
'Just a check
    Debug.Print "    Permissions: " & ctr.Permissions
'Just a check
    Debug.Print "    AllPermissions: " & ctr.AllPermissions            'Just
a check

    If ctr.AllPermissions = 393216 Then
        Call StartupFunctionTBS
        Call CheckMenuFile
        dbs.Close
        Exit Function
    Else
        Call HideDBwindow
        Call StartupFunctionUser
        Call CheckMenuFile
        dbs.Close
        Exit Function
    End If

'**************************************Code
Begin**************************************

Mik Achton-Boel



Mon, 08 Jan 2001 03:00:00 GMT  
 User and CloseButton - RE:
:"Concerning CloseWindowButton"
:
:Thank you for tanking time to answering, but how can I trap this
:information.
:
:The for is a menu thats means that I have some code in the CoseEvent, which
:comes after the UnloadEvent.
:
:That means if the I have to put some code in the UnloadEvent that will
:"disable" all the other events on the form. Do you get the point.

Hi Mik,

I apologize for sounding dumb.  But I still fail to understand what you're
trying to do.  I again point out the fact that if the Cancel argument of
Unload event is set to true, it will take precedence and not allow the form
to close.

Sorry if this didn't help.
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------



Mon, 08 Jan 2001 03:00:00 GMT  
 User and CloseButton - RE:
Hi Dev

This works

I call the function from both the OnUnlod event of the form + I have an
CommandButton on the form which call the same
function. If I do not call the function from the OnUnLoad event and close
the form with that little x in the corner you know
it just close the form.

'------------------------------------------------------------
' frmMenuMain_CloseSub
'------------------------------------------------------------
Function Open_frmMenuMain_CloseSub()
On Error GoTo ErrorHandler_Err

    DoCmd.OpenForm "frmMenuMain", acNormal, "", "", acEdit, acNormal,
"=frmMenuMain()"
    DoCmd.Close acForm, "frmMenuMainSub01"

ErrorHandler_Exit:
    Exit Function
ErrorHandler_Err:
    Const conErrDoCmdCancelled = 2501
        If (Err = conErrDoCmdCancelled) Then
            Resume ErrorHandler_Exit
        Else
            MsgBox Error$
            Resume ErrorHandler_Exit
        End If
End Function

Best regards

Mik

Quote:
>Hi Mik,

>I apologize for sounding dumb.  But I still fail to understand what you're
>trying to do.  I again point out the fact that if the Cancel argument of
>Unload event is set to true, it will take precedence and not allow the form
>to close.

>Sorry if this didn't help.

>Dev Ashish (Just my $.001)
>---------------
>The Access Web ( http://home.att.net/~dashish )
>---------------



Tue, 09 Jan 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CloseButton and User

2. need help with CloseButton=false

3. CloseButton

4. Hide or Disable the closebutton of a Userform

5. Disable closebutton

6. Disable the ControlBox (Window CloseButton)

7. ControlBox (Window CloseButton)

8. Min, Max, and CloseButton question

9. CRViewer CloseButton not enabled ?

10. one user but "another user" error

11. Single-user errors on multi-user apps

12. Getting the User Group name using Current User Function

 

 
Powered by phpBB® Forum Software