UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> "selecting" msysobjects table in access 2007 VBA    
 
   
lstellyl
post Aug 7 2008, 11:26 AM
Post #1

UtterAccess Member
Posts: 20



Hi guys, i am trying to give the user the ability to show/hide the navpane, ribbon, and access window from a form... i am using the following code:

CODE
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


Public Function HideNavPane() As Byte
    Select Case SauerUserStr
        Case "CENTENARY"
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowHide
            
        Case "QUOTING"
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowHide
            Form_Analysis.Modal = True
            
        Case "ENGINEERING"
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowHide
            [Form_Part Detail].Modal = True
            
        Case Else
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowHide
            [Form_Part Detail].Modal = True
            [Form_Analysis].Modal = True
    End Select
End Function



Public Sub ShowNavPane()
    Select Case SauerUserStr
        Case "CENTENARY"

        Case "QUOTING"
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowUnhide
            Form_Analysis.Modal = False
            
        Case "ENGINEERING"
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowUnhide
            [Form_Part Detail].Modal = False
            
        Case Else
            DoCmd.SelectObject acTable, "MSysObjects", True
            DoCmd.RunCommand acCmdWindowUnhide
            [Form_Part Detail].Modal = False
            [Form_Analysis].Modal = False
    End Select
End Sub



Public Sub HideRibbon()
    Select Case SauerUserStr
        Case "CENTENARY"
            DoCmd.ShowToolbar "Ribbon", acToolbarNo
            
        Case "QUOTING"
            DoCmd.ShowToolbar "Ribbon", acToolbarNo
            
        Case "ENGINEERING"
            DoCmd.ShowToolbar "Ribbon", acToolbarNo
            
        Case Else
            DoCmd.ShowToolbar "Ribbon", acToolbarNo
    End Select
End Sub



Public Sub ShowRibbon()
    Select Case SauerUserStr
        Case "CENTENARY"
            
        Case "QUOTING"
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
            
        Case "ENGINEERING"
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
            
        Case Else
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
    End Select
End Sub


the fsetaccesswindow function was code that i got from online and it works (relatively) well

the show/hide ribbon commands work.... somewhat well

the navpane however, is where i am having the trouble... i got that code from the internet as well and apparently the command only works when the table mSysObjects is in focus. now i have never worked with the system tables nor do i have a strong desire to do so, however i need to get this to work...

when it tries to select the table i get the error 2544 and the message: "(my database) cant find the MSysObjects you referenced in the object name argument"

does anybody know what i am doing wrong or how to do this? any help is appreciated, i have tried googling and have found nothing
Go to the top of the page
 
+
 
Start new topic
Replies
lstellyl
post Aug 7 2008, 03:45 PM
Post #2

UtterAccess Member
Posts: 20



yes the form is a modal popup (it has to be in order for the access window to be hidden)


AHH i figured it out.... kind of

the table i was looking at was in a group that was collapsed in the nav pane... if i expand the group that it is in, it is allowed to select it and then it works...


though i still do not know why the ribbon one doesnt work, it may be a similar problem.. is there some reason that hiding the access window and then bringing it back up would somehow put the ribbon unselectable or out of reach?
Go to the top of the page
 
+

Posts in this topic


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 19th April 2014 - 03:41 PM