?
Solved

How to specify the connection string of an ADODC control at runtime.

Posted on 2002-07-26
7
Medium Priority
?
331 Views
Last Modified: 2010-05-02
I want an ADODC which has to connect to a different location(database,username and password).

Now when i specify the connection string at design time the databinding of the other controls seem to work fine. Now when i remove the connectionstring from the design time settings and then set the connection string of the ADODC control at run-time, the ADODC gives an error of 'Object Required' when any reference to the underlying recordset is made.

It will be great if someone has a solution for the same.
Many thanks in advance as it is a matter of urgency.
0
Comment
Question by:john_vimal
[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
7 Comments
 
LVL 4

Expert Comment

by:Glowman
ID: 7180149
John,

I am not sure but it seems that your controls are trying to initialize before your suppling the connection string.  You could try to give your app the connection string sooner in your code like in the form initialize event perhaps.

G
0
 
LVL 10

Expert Comment

by:aeklund
ID: 7180157
Can you show us the code in which you are removing and settings the connection string?
0
 
LVL 2

Expert Comment

by:yongyih
ID: 7180233
May be you need to set the connection string in form_load and set it to your control. ^_^

good luck.
0
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!

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7180453
Actually you need to set it before you Show the form.  In other words make Main() in a .bas module the startup object and initialize the Data Control to the connection string here, than do a Refresh and finally Show the form.

Having said this, you may want to re-consider using the Data Control in the first place as they are typically more trouble than they are worth.  Most developers use them once in a major app and never again.

Anthony
0
 
LVL 2

Accepted Solution

by:
ventond earned 300 total points
ID: 7180693
If you change a data controls connection string at run time (after it has already opened), you must tell the data control to reconnect. (Re Open). Or, better solution, don't have it set in design time at all.

Set it in design time, use the retrieve fields of your other controls, then unset it. That way the data control will never have established the first connection string before you change it, and you won't have to Re-open the control.
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7652557
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to Glowman
Please leave any comments here within the
next seven days.
0
 

Author Comment

by:john_vimal
ID: 7654234
thanks for your help mate
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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 Month8 days, 18 hours left to enroll

765 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