?
Solved

Designer question

Posted on 2003-03-26
4
Medium Priority
?
136 Views
Last Modified: 2010-05-01
I want the user to be able to switch databases without closing down the application, but when I try to switch databases I get an error telling me "operation is not allowed when object is open".  And when I go to debug it takes me to the code where I reassociate the dataenviroment with the new database - DataEnv.cnnDataEnv.ConnectionString = strConn. Any help with this would be greatly appreciated.  Thank you in advance.

Sam
0
Comment
Question by:Sam8932
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 100 total points
ID: 8211355
try this,Close the existing connection first:

DataEnv.cnnDataEnv.Close

then

assign the New connection string, and then re-open the new connection

DataEnv.cnnDataEnv.ConnectionString = strConn
DataEnv.cnnDataEnv.Open

Arthur Wood
0
 

Author Comment

by:Sam8932
ID: 8211475
Thanks Arthur,
I actually tried that already and it kind of works.  I don't get any errors, but the datacombo(I'm using DataEnv to populate it) doesn't populate when I switch databases.  Any ideas?
0
 

Expert Comment

by:CleanupPing
ID: 8531549
Hi Sam8932,
This old question (QID 20563927) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8544114
try using the Requery method of the datacombo - just a guess, as I personnaly never use any of the bound controls.  All data handling is doen entirely in code.  Much easier to 'control' what happens and when.

AW
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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