- Local time
- Today, 08:20
- Joined
- Sep 12, 2006
- Messages
- 16,096
Can you provide the exact code you are using to maintain the persistent connection.
You can do this in a variety of ways.
I have an empty table called dummytable
In my startup, I declare a recordset, and connect it to that table
	
	
	
		
Now an unhandled error will trash my public variables including dummyrst, and the persistemt connection will fail
I add a button to my switchboard to check the persistent connection, although I never need it
	
	
	
		
when my database closes, I add
	
	
	
		
One thing that you will see is if you try to reconnect your data tables
If you don't have a persistent connection. it might take 1 second per table to connect the tables for a database that is already in use by another user. So a 20 table database might take 20 seconds. Every time you open a form, or run a query, the same delay happens.
If you create the persistent connection FIRST, and then connect the tables, it will take one or two seconds., and as long as the persistent connection remains, you don't get any further performance hits.
 You can do this in a variety of ways.
I have an empty table called dummytable
In my startup, I declare a recordset, and connect it to that table
		Code:
	
	
	public dummyrst as recordset
function startup()
dim db as database
set db=currentdb
set dummyrst= db.openrecordset("dummyTable")
end function
function checkdummyrecordset() as boolean
checkdummyrecordset = not (dummyrst is nothing) 'this syntax to avoid run time errors by trying to use a recordset that does not exist
end functionNow an unhandled error will trash my public variables including dummyrst, and the persistemt connection will fail
I add a button to my switchboard to check the persistent connection, although I never need it
		Code:
	
	
	if checkdummyrecordset then
    msgbox "The persistent connection is active"
else
    msgbox "The persistent connection is not active"
end ifwhen my database closes, I add
		Code:
	
	
	if checkdummyrecordset then 'again, to avoid run time errors.
   dummyrst.close
   set dummyrst=nothing
end ifOne thing that you will see is if you try to reconnect your data tables
If you don't have a persistent connection. it might take 1 second per table to connect the tables for a database that is already in use by another user. So a 20 table database might take 20 seconds. Every time you open a form, or run a query, the same delay happens.
If you create the persistent connection FIRST, and then connect the tables, it will take one or two seconds., and as long as the persistent connection remains, you don't get any further performance hits.
 
	 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		