Results 1 to 4 of 4

Thread: Database Window

  1. #1
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database Window

    Help.

    Is there code that can go behind a button to display the database window?

    Thanks,

    Jonathon

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

    Re: Database Window

    Try this. This will work in both 97 and 2000, but if you're using Access 2000, you would need to set a reference to the DAO 3.6 object library.

    Public Function ShowDBWindow()
    ' Charlotte Foust 6/20/98
    ' last modified 9/25/00
    On Error Resume Next
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim intCnt As Integer

    Set dbs = CurrentDb
    ' Get the number of tables in the database
    intCnt = dbs.TableDefs.Count
    ' Reference the last table and select it
    ' in the Database Window
    Set tdf = dbs.TableDefs(intCnt - 1)
    ' Show the database window
    Do
    intCnt = intCnt - 1
    Debug.Print tdf.Name
    If (tdf.Attributes And dbSystemObject) Or _
    (tdf.Attributes And dbHiddenObject) Then
    Set tdf = dbs.TableDefs(intCnt - 1)
    Else
    DoCmd.SelectObject acTable, tdf.Name, True
    Exit Do
    End If
    Loop Until intCnt = 0
    ShowDBWindow = True
    Proc_exit:
    Application.Echo True
    Set tdf = Nothing
    Set dbs = Nothing
    End Function
    Charlotte

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Database Window

    Hi,
    Have you disabled the f11 key? If not, you can either use that or use SendKeys {f11} in code.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Database Window

    [img]/w3timages/icons/smile.gif[/img] Try this line of code:

    DoCmd.SelectObject acTable, , True

    Works in Access '97 at least.

Posting Permissions

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