Solved

Start ADP without setting the connection to SQL

Posted on 2008-06-19
8
746 Views
Last Modified: 2013-12-05
My goal is to use the same ADP on 2 different networks, with 2 different SQL Servers and 2 different database names, so the connections strings are different.

I programatically change the connection during the startup, but I have to wait for a timeout on the default connection.

How can i start the ADP without connecting to the SQL DB, so that I can change the connection strings in VBA.
0
Comment
Question by:ScottGutman
  • 2
  • 2
  • 2
8 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 400 total points
ID: 21821605
run this in vba immediate window:

Application.CurrentProject.CloseConnection 'Close the Connection
Application.CurrentProject.OpenConnection '
0
 
LVL 44

Assisted Solution

by:Leigh Purvis
Leigh Purvis earned 100 total points
ID: 21823808
AFAIK the only way to have the ADP *start-up* without attempting a connection is to create a blank ADP file and Cancel any requests for establishing the connection through the UI.
Then import all your objects into that ADP and go with it.
Any attempt to close or remove the ADP's default connection does not persist into the next instance of the application.

Sorry - it's a faff, but at least you have the workaround and could do it only before releasing new versions (just like part of the process such as creating an ADE etc etc).
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 21826463
> Any attempt to close or remove the ADP's default connection does not persist into the next instance of the application.

Not any. Put empty OpenConnection in form_close event, and it will persist.

ScottGutman, I'm very curious, did you try what I suggested?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 21826803
Fair play - that's a new one on me (not that I'd claim to be an authority on ADPs anyway).
The old literature on the subject is clearly unaware of the trick of calling the OpenConnection method without passing any connection information.

That's the answer you'll need Scott.
0
 

Author Comment

by:ScottGutman
ID: 21829927
Ok, I was a little hasty.  Thanks for bringing this to my attention.  can the moderator undo my selection so i can change the points assigned?
0
 

Author Closing Comment

by:ScottGutman
ID: 31468728
the answer was just too simple and LPurvis usually knows EVERYTHING :).

Thanks a bunch, guys!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

929 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

11 Experts available now in Live!

Get 1:1 Help Now