Solved

ADODC.connectionstring empty at form_load...

Posted on 1999-01-07
4
175 Views
Last Modified: 2013-12-25
I want to specify my ADODC.Connectionstring during the form_load of a program and keep this property empty as initial value. But I get an error at startup (before the form_load is completed) that the string is missing. With a normal Data-control the data1.databasename can be specified in the form_load. Why not with ADODC?
0
Comment
Question by:juul040798
  • 2
4 Comments
 
LVL 2

Expert Comment

by:mkmccreary
ID: 1498818
Is the error you get:
    Data Source name not found, and no default driver specified.

or something like that.  If so try this.  Clear both the ConnectionString and the RecordSource property of the ADODC.  Then set the ConnectionString first, and the RecordSource next, during your Form_Load.  If this isn't your error, give me a little more information and I will try to figure it out for you.

Good Luck,
Martin
0
 
LVL 4

Accepted Solution

by:
agarwal_rahul earned 100 total points
ID: 1498819
As Martin said clear both Connectionstring and Recordsource property and set at run time.

e.g

form_load()
    Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=SG73300233"
    Adodc1.RecordSource = "SELECT * FROM ORDERS"
    Adodc1.Refresh
end sub

0
 

Author Comment

by:juul040798
ID: 1498820
Is it possible that the adodc1.refresh is crucial in this subject. When I do this without the refresh, it seems not to work...
0
 
LVL 4

Expert Comment

by:agarwal_rahul
ID: 1498821
Without Refresh u will not be able to populate the recordset.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 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

15 Experts available now in Live!

Get 1:1 Help Now