ADP disconnect / reconnect using code

Posted on 2004-11-28
Last Modified: 2006-11-17
Hi there,

We've written a utility (ADP - SQL backend / Access ADP on the front) that we need to disconnect from the SQL server via code each night and then reconnect early in the morning.  Does anyone know how to do this via code?  Thanks!
Question by:CameronFrasnelly
    LVL 18

    Expert Comment

    Is the application closed every night.  shutting down the ADP will disconnect if from SQL Server.  May I ask why you want to do this via code?


    Author Comment

    No we don't want to ever shut the application down.  We shutdown our SQL servers each night prior to backing them up which causes our utility to error out so we need to shut it down at 11pm and re-connect at 2am.  And I can't get anyone to volunteer to come in! :)
    LVL 18

    Accepted Solution

    Take a look at the close connection method


    Then, look at the OpenConnection to re-established the connection

    Create a hidden form and set the timer interval.  When the event fires, check the current time...if 11PM, then close the connection.   When the time is 2AM, open the connection.


    Author Comment

    Thanks did some digging on google for CurrentProject.CloseConnection and found some sample code!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now