Code Examples

Choose a Database Tab

acCmdViewDataAccessPages, acCmdViewForms, acCmdViewMacros, acCmdViewModules, acCmdViewQueries, acCmdViewReports, acCmdViewTables

This code makes the database window display the required tab. It would probably be easier just to use DoCmd.SelectObject.

'***************** Code Start *******************
' Code by Terry Wickenden

Sub ShowDatabasePage(strPage As String)

  Dim intCommand As Integer

  DoCmd.SelectObject acTable, , True
  Select Case LCase(strPage)
    Case "table"
      intCommand = acCmdViewTables
    Case "query"
      intCommand = acCmdViewQueries
    Case "form"
      intCommand = acCmdViewForms
    Case "report"
      intCommand = acCmdViewReports
    Case "macro"
      intCommand = acCmdViewMacros
    Case "module"
      intCommand = acCmdViewModules
    Case "page"
      intCommand = acCmdViewDataAccessPages
    Case Else
      'not a valid argument passed
      Exit Sub
  End Select
  DoCmd.RunCommand intCommand

End Sub

'****************** Code End ********************

© 1998 - 2011 Terry Wickenden TKW Design Site developed, maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.