Results 1 to 2 of 2
  1. #1
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659

    Question How to close global database objects

    Greetings,



    I am using a Workspace for transaction rollbacks. When I set the variable on Launch of the database. it prevents the database from closing. Here are my two Functions, for starting and exiting. This code does not let me exit the database if I uncomment the set lines in initializedatabase. What is the proper way to unset these values so the database can exit gracefully?

    Code:
    Global gdb As dao.Database
    Global gws As dao.Workspace     
    
    Public Function InitializeDatabase()
    'Set gdb = CurrentDb
    'Set gws = DBEngine.Workspaces(0)
    DoCmd.OpenForm "frmMain"
    
    
    End Function
    
    
    Public Function ExitDatabase()
    Set gdb = Nothing
    Set gws = Nothing
    DoCmd.Quit acQuitSaveNone
    
    
    End Function

    Thank you in advance

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,929
    if you are closing the db, there is no need to set your variable to nothing - closing the db will do the cleanup and free the memory

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copying Objects to a new database
    By plengeb in forum Programming
    Replies: 1
    Last Post: 04-05-2018, 05:39 PM
  2. Replies: 9
    Last Post: 11-13-2016, 06:55 PM
  3. Replies: 5
    Last Post: 09-01-2014, 12:11 PM
  4. Replies: 43
    Last Post: 03-27-2014, 01:51 AM
  5. Replies: 2
    Last Post: 03-29-2013, 12:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums