Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado recordsource linking

Status
Not open for further replies.

antvon

Programmer
Dec 2, 2002
45
Hi

I have several ado data controls on various forms
that have their recordsources set to a sql server
string

What I'd like to do is set these ado's recordsource
strings to another value (so that a different user
can log in to the database)

I have tried setting the ado recordsource in the
form load event, but when I access the control it
still looks at the control property first for the
recordset - tries to connect - fails and then
looks at the form load event for the string
and loads correctly

having an empty recordsource on the ado does'nt
work either.

Thanks in advance
 
Oops

I meant connectionstring not recordsource

ie. ado control's connectionstring set to
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CompanyX;Data Source=MRX

In my main form's load event I set the control's
connectionstring to

cnnstr =
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CompanyY;Data Source=MRY

adocontrol.connectionstring = cnnstr
adocontrol.refresh

As soon as the form load event occurs however it tries
to connect to the control's original connection string
and fails to connect.Then the form load event passes the
correct string and it connects fine.

How do I set the connection without connecting to the
original connection?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top