We help IT Professionals succeed at work.

Keep trying to reestablish connection when connection lost

H-SC
H-SC asked
on
171 Views
Last Modified: 2008-03-06
I have a database that is on a network server.  I have a particular client machine that stays in the database most of the time.  Sometimes the client machine gets taken off the network.  I would like for the database on the client to try and reestablish it's connection when the machine connection is back online.  


Thanks In Advance
Comment
Watch Question

CERTIFIED EXPERT

Commented:
Hi H-SC,
You cannot be serious!
You are disconnecting a machine while the Access database is still open on that machine?

Pete

Author

Commented:
Pete,

Unfortunately yes..  I know that it sounds weird, but the database has a form that displays information only...no data input from this client machine.
CERTIFIED EXPERT

Commented:
H-SC,
I'm not sure anyone should be encouraging you to continue with this arrangement.  It is the number one scenario for database corruption.
I'll ask the obvious thing first.
Why can't the person who is disconnecting and connecting the machine from the network sort this out properly, by closing and reopening the application accordingly?

After that, if it's just a single form displaying data then what you could do is load an unbound form when the database opens and use its form_timer event procedure to test the connection. Then if the connection is OK and the main form is not open, open it; if the connection is not there, and the main form is open, close it.

Pete

Author

Commented:
Pete,


Thank you...I know, I do have the same concerns on db corruption as well.

"Why can't the person who is disconnecting and connecting the machine from the network sort this out properly, by closing and reopening the application accordingly?"

  Sometimes this is done at router or remote.  Even though I know it is a risk to db corruption In this particular case only....I am willing to deal with the scenerio.

"use its form_timer event procedure to test the connection"  ...  I guess the question is... How can this be accomplished?
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
Look into replication.  The user will be able to continue using the database while disconnected and the data will update when connected.  Since the user is using the data read only, it will be a fairly easy replication setup.  to set it up: Tools, Replication, Create Replica.

Or since it is read only, you can use a timer event to copy the database or Backend to the local drive and use the local copy.

As Pete warned, do not continue disconnecting from the network with the database running!  This can result in corruption that cannot be recovered.

Author

Commented:
pete,

Many thanks for the code...I will try it today 2/21 and get back to you

Author

Commented:
thenelson,

Thank you for the replication insight.  I would like to keep things where they are for now as far as basic server/client using linked.  I did not know that is how replication worked, have never used it ... interesting.

Author

Commented:
pete,

Can you add how the code would look for this case.... ' code here to open the main form if it is not open

Set rs = CurrentDb.OpenRecordset("dummy")
rs.Close
Set rs = Nothing
'MsgBox "connection OK"
' code here to open the main form if it is not open

Thanks Again

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.