By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

Temporarily Closing DAO connection

P: 63
Hi,

I have too many inserts to deal with but the at specific part of the code is intense on computation where I would like to temporarily close connection and then once the computations are done I could restart it.

I dont care if time gets wasted.

Expand|Select|Wrap|Line Numbers
  1. Sub Main()
  2.   ' First we initialize paths for all needed files
  3.   gstrDBPath = "c:\dvp\PKB"
  4.  
  5.   Set gdbFML = OpenDatabase(gstrDBPath & "\Common.mdb")
  6.   Load frmPalletComplete
  7.   frmPalletComplete.Show vbModal
  8.  
  9.   Dim frm As Form
  10.   ' Loop through all open forms and close them
  11.   For Each frm In Forms
  12.     Unload frm
  13.   Next frm
  14.  
  15.   gdbFML.Close
  16.  
  17. End Sub
  18.  
  19.  
This my MAIN function and I have it in MODULE.
I need to open connections to this repeatedly is this possible?? and a good idea??
Nov 25 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
Will you actually gain anything by closing the connection? If you're not using the connection at that point, surely all it's using is some RAM.
Nov 30 '07 #2

QVeen72
Expert 100+
P: 1,445
Hi,

In .bas module Write 2 Public Procedures to Close and Open the database,
and call those procedures,:

Expand|Select|Wrap|Line Numbers
  1. Public Sub MyCloseDB()
  2.       gdbFML.Close
  3. End Sub
  4.  
  5. Public Sub MyOpenDB()
  6.       Set gdbFML = OpenDatabase(gstrDBPath & "\Common.mdb")
  7. End Sub
  8.  
Just Call MyCloseDB and MyOpenDB from anywhere through out your Project..



Regards
Veena
Nov 30 '07 #3

P: 63
Cool it works ... thanx a lot.
Dec 1 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.