Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove Access controls (2000)

    Hi,
    Does anyone have an idea on how to remove the actual Access Controls from a database. I have a database that has all the Minimize/Maximize, customized toolbar, etc, but the actual Access Toolbars are still readily available. I want the user to have to use my controls, and not be able to bypass them by clicking the 'X' or '-' etc on Access.
    Hope this makes sense.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    You can disable the close button of the Access application window. See MSKB article ACC2000: How to Disable the Close Button (X) on the Access Application Window.

    You can also prevent the user from closing a form except by clicking a command button on your form. See for example <post#=94249>post 94249</post#>.

    You can hide the standard toolbars in the startup settings of the database (Tools | Startup...)

  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    Hi Hans,
    Just a quick question, how would I apply this two my database? I currently have a switchboard that links to Front End and Back End files.
    Would:
    Dim fOKToClose As Boolean
    go on the coding in the form, and if so whereabouts? On the activate command, or somewhere different. I currently have a maximize macro on this command.
    Presumably,
    Private Sub Form_Load
    'set the trap, so no one can close the form without
    'clicking the Close Button
    foKTToClose = False
    End Sub

    Private Sub Form_Unload(Cancel as Integer)
    Cancel = Not fOKToClose
    End Sub

    My close button is titled CmdExit so will this have an effect on the coding, I know that anything with ' in front of it is just classed as text so I suspect not. Also I presume this will go on the Load/Unload forms command in the form seperately.

    The last vb goes on the ExitCmd and presumably would look like this:

    Private Sub CmdExit_Close()
    fOKToClose = True
    End Sub

    If you would'nt mind clarifying this for more I'd be nmost grateful.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    The only thing lacking is that you must actually close the form or quit Access in the code behind cmdExit:

    Private Sub cmdExit_Click()
    fOKToClose = True
    ' Either close the form:
    DoCmd.Close acForm, Me.Name, acSaveNo
    ' Or quit Access:
    Application.Quit
    End Sub

    The declaration Dim fOKToClose As Boolean needs to be placed at the top of the form module, just below the lines Option Compare Database and Option Explicit, but before all Subs and Functions in the module.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    This is the coding that I have on the form currently.
    I have a database with FE and BE files, and a main Interface.
    This code:

    Private Sub CmdExitAll_Click()
    On Error GoTo Err_CmdExitAll_Click

    Dim strAccessExe As String, strFile As String

    strFile = CurrentProject.Path & "Interface.mdb"
    strAccessExe = SysCmd(acSysCmdAccessDir) & "msaccess.exe"

    If Dir(strFile) = "Interface.mdb" Then
    Call Shell(strAccessExe & " """ & strFile & """", vbMaximizedFocus)
    Else
    MsgBox "Couldn't find DB Interface"
    End If

    DoCmd.Quit

    Exit_CmdExitAll_Click:
    Exit Sub

    Err_CmdExitAll_Click:
    MsgBox Err.Description
    Resume Exit_CmdExitAll_Click

    End Sub

    I still want the same process, but currently users are not exiting via the exit control, just exiting Access.

    I also have this code on the other form:

    Private Sub CmdMainExit_Click()

    On Error GoTo Err_CmdMainExit

    Dim strAccessExe As String, strFile As String

    strFile = CurrentProject.Path & "Interface.mdb"
    strAccessExe = SysCmd(acSysCmdAccessDir) & "msaccess.exe"

    If Dir(strFile) = "Interface.mdb" Then
    Call Shell(strAccessExe & " """ & strFile & """", vbMaximizedFocus)
    Else
    MsgBox "Couldn't find DB Interface"
    End If

    DoCmd.Quit

    Exit_CmdMainExit:

    Exit Sub

    Err_CmdMainExit:

    MsgBox Err.Number & ": " & Err.Description
    Resume Exit_CmdMainExit

    End Sub

    And finally,

    Public Sub CloseInterface()

    DoCmd.Quit

    End Sub

    On the CloseInterface argument in the Interface that links the tables.

    Needless to say, I am out of my depth.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    Nigel,

    In which database, and on which form in that database does the CmdExitAll button live?

    In which database, and on which form in that database does the CmdMainExit button live?

    In which database, and where in that database, does the CloseInterface procedure live, and where and how is it used? (I don't know what "the CloseInterface argument" is.)

  7. #7
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    Sorry my fault.

    CmdExitAll lives on the Database 'Briefs to Counsel', this is on FrmMain. It Exits the user to Interface.mdb

    CmdMainExit lives on the Database 'Committals Log, this is on FrmMain. It Exits the user to Interface.mdb

    The Interface.mdb is a centralized form within a single folder. Within this folder are the front end Database 'Briefs To Counsel' & 'Committals Log'. The Back end files are in a seperate folder.

    The Interface has been set up with FE and BE databases. The Interface links to these through modules (i think), its probably best to explain how its done by actually looking on the post. Its the third one down with the attachment.

    http://www.utteraccess.com/forums/showflat...part=2&vc=1

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    I cannot download attachments from that link, but you need to put the code in each of the frmMain modules, and use cmdExitAll and cmdMainExit to set the boolean variable to True.

  9. #9
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    Hi Hans,
    I'm slowly getting there.............
    The coding I'm having trouble with is:
    DoCmd.Close acForm,Me.Name,acSaveNo
    It doesn't seem to like the Me. , I understand that this would be naming the form, so Me.Switchboard, in this case. Still doesn't like it though!
    Any ideas?

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Remove Access controls (2000)

    Me refers to the class object in which the code is being run. It can be a form, report or user-defined class module. You can't use Me in a standard module, Does that help?
    Charlotte

  11. #11
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    It explains it but I am useless with VB.
    The coding is so that the user can only exit the form with the Exit control. Using Boolean, so the user cannot use the Access 'X' button to exit the database.

    Private Sub cmdExit_Click()
    fOKToClose = True
    'Either close the form:
    DoCmd.Close acForm, Me.Switchboard, acSaveNo
    'Or quit Access:
    Application.Quit
    End Sub

    Its the Me.Switchboard it doesn't like, I'm not too sure what I would need to use. The Switchboard is the form I'm trying to close, although the actual Application will need to close with the cmdExit. Me being niave, should acSaveNo be acSaveYes if I wish to save what has been done on the form?

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    Since this code is in the form module, you should use the code as posted by me: Me.Name, literally. Me refers to the form that contains the command button, and Name is a property of the form. In this example, Me.Name evaluates to "Switchboard", but the advantage of using Me.Name is that it will still work if you rename the form.

    By the way, you should use only one of the lines DoCmd.Close ... and Application.Quit, not both.

    The acSaveNo means that changes in the design of the form should not be saved; if several users share the same frontend, this can help prevent problems. The acSaveNo has nothing to do with saving the data in the current record, that is done automatically by Access.

  13. #13
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    I feel so dense sometimes!!!!!!!!!!!!!

    This is the coding on the database FE, Exit control.

    Private Sub CmdMainExit_Click()

    On Error GoTo Err_CmdMainExit

    Dim strAccessExe As String, strFile As String

    strFile = CurrentProject.Path & "Interface.mdb"
    strAccessExe = SysCmd(acSysCmdAccessDir) & "msaccess.exe"

    If Dir(strFile) = "Interface.mdb" Then
    Call Shell(strAccessExe & " """ & strFile & """", vbMaximizedFocus)
    Else
    MsgBox "Couldn't find DB Interface"
    End If

    DoCmd.Quit

    Exit_CmdMainExit:

    Exit Sub

    Err_CmdMainExit:

    MsgBox Err.Number & ": " & Err.Description
    Resume Exit_

    How on earth would I work the coding around this?

    Would it be, after "Couldn't find database"

    fOKToClose = True
    DoCmd.Quit

    Exit_CmdMainExit:

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Access controls (2000)

    Yes, fOKToClose = True should be before DoCmd.Quit. And, as noted before, you must have

    Dim fOKToClose As Boolean

    at the top of the form module, after Option Compare Database and Option Explicit (if you have those) and before all Subs and Functions.

  15. #15
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Access controls (2000)

    Yet another question, sorry.
    At the top of the form module, there is no Option Compare Database and Option Explicit.
    I have therefore inserted the Dim fOKToClose as Boolean at the top.
    On the exit cmd, before DoCmd.Quit, I have inserted fOKToClose = True, but the user is still able to exit the database with the "X". What have I done wrong?
    Also, what is a Boolean, just curious?

Page 1 of 2 12 LastLast

Posting Permissions

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