Link to home
Start Free TrialLog in
Avatar of João serras-pereira
João serras-pereiraFlag for Portugal

asked on

Hide tables, queries, forms and reports on ms/access 2010 VBA

When my ms/access 2010 application starts I want the user to only acceede to the forms and reports via programmed buttons; thus I do not want to show thw ribbon or the background pane.
How do I do it?
Avatar of Anthony Berenguel
Anthony Berenguel
Flag of United States of America image

in Access goto
File --> Options --> Current Database:

- Display form: select the form you want to appear when the DB opens
- Uncheck Display Navigation Pane
- Uncheck Allow Full Menus
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of João serras-pereira

ASKER

A BIG THANKS!!!
ooops...
I am getting the error 2544: canot find the Object MSysObjects". Below I am sending in the snapshot and the code

can you still help?


User generated image

User generated image

Private Sub Form_Close()

    Dim cdiDB As DAO.Database

    ' define and open the common record sets

    Dim LogFileSet As DAO.Recordset             ' this is the LogFile
    Dim T00_ControlTableSet As DAO.Recordset    ' this is the Control Table record set (only one record, of course
    Dim T01_UserSet As DAO.Recordset            ' this contains the user Table
 
    Set cdiDB = CurrentDb
    Set LogFileSet = cdiDB.OpenRecordset("T02_LogFile", dbOpenTable)
    Set T00_ControlTableSet = cdiDB.OpenRecordset("T00_ControlTable", dbOpenTable)
    Set T01_UserSet = cdiDB.OpenRecordset("T01_User", dbOpenTable)

   
    Dim strUserID As String
    Dim SForm As String
    Dim NoUsersLogged As Boolean
    Dim NomeDoGajo As String
    Dim SPass As String, strTxt As String
    Dim Found As Boolean
    Dim IErro As Integer
    Dim IBool As Boolean
    Dim NoUser As Boolean
   
   
    On Error GoTo ProcError
    NoUser = False
   
    T01_UserSet.Edit
    T00_ControlTableSet.Edit
   
    If CurrentProject.AllForms("F91_LoggedUser").IsLoaded Then
        strUserID = Nz(Forms![F91_LoggedUser]![CurrentUserID], "")
    Else
        strUserID = "##NA##"
    End If
    IBool = InsertLog("F00 Close", "Close", "", "", "", 0, 0, strUserID, "Close Btn")
    [T00_ControlTableSet]![T00_NumberOfUsers] = [T00_ControlTableSet]![T00_NumberOfUsers] - 1
    Found = False
    ' search for the user that must be logged off
    Do While (Not [T01_UserSet].EOF) And (Not Found)
        If ([T01_UserSet]![T01_Nome] = Forms![F91_LoggedUser]![CurrentUserID]) Then
            sUserID = [T01_UserSet]![T01_Nome]
            Found = True
        Else
            T01_UserSet.MoveNext
        End If
    Loop
    T01_UserSet.Edit
    [T01_UserSet]![T01_Logged] = False
    [T01_UserSet]![T01_LastTimeStampOut] = Now()
    'clean F91
    If CurrentProject.AllForms("F91_LoggedUser").IsLoaded Then
        Forms![F91_LoggedUser]![CurrentUserID] = ""
    End If
    T01_UserSet.Update
    T00_ControlTableSet.Update
    IBool = InsertLog("Logout", "Finit", "T01_User", "", "", 0, 0, strUserID, "")
    T00_ControlTableSet.Close
    Set T00_ControlTableSet = Nothing
    T01_UserSet.Close
    Set T01_UserSet = Nothing
    cdiDB.Close
    Set cdiDB = Nothing
    Exit Sub
    DoCmd.ShowToolbar "Ribbon", acToolbarYes
    DoCmd.SelectObject acTable, "MSysObjects", True
   
ProcError:
    IBool = InsertLog("Form Close", "Arranca", "", "", "", 0, 0, strUserID, "Erro em fecho arranca")
    DoCmd.ShowToolbar "Ribbon", acToolbarYes
    DoCmd.SelectObject acTable, "MSysObjects", True  <<------------- ERRR LINE
End Sub
To bring back the Navigation Pane, just use this instead:
DoCmd.SelectObject acTable, , True
PERFECT and thanks again