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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help with connecting to external data source 1

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I am trying to connect to an external source using an ADO connection but not having much success. I believe their is some type of security but I know the username and there is no password so I'm wondering why I cant open the connection. When I run the code below I get an error message that says "Cannot start your application. The workgroup information file is missing or opened exclusively by another user."

Here is my code so far

Sub GetCribHours()
Dim strdb As String, strSQL As String
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim fld As Field
strdb = "N:\cribmastersql\SQL Link for Queries.mdb"
strSQL = "SELECT AssetNo,WOComment,DateClosed FROM WO;"
cnt.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = " & strdb & ";" & _
"User Id= sa;" & _
"Password="
Set rst = cnt.Execute(strSQL)
End Sub

I tried putting admin instead of sa and I got an ODBC connection to crib failed alarm.

Any help in the right direction would be nice.



Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Do you already have this database open? SQL Link for Queries.mdb i.e. Are you trying to connect from inside this app?

sa is the default admin password for sql server. Why are you using on an Access mdb connection?
 
The table is is a Linked table to an SQL database. I don't know if this helps you at all. I'm kind of new to this SQL stuff.

Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Here is an example of an SQL Server connection.

Dim cn As New ADODB.Connection, sql1 As String
Dim rs As New ADODB.Recordset, connString As String

connString = "provider=SQLOLEDB.1;" & _
"User ID=sa;Initial Catalog=yourdatabase;" & _
"Data Source=yourserver;" & _
"Persist Security Info=False"

cn.ConnectionString = connString
cn.Open
sql1 = "select * from dbo.Customers"
rs.Open sql1, cn, adOpenStatic, adLockOptimistic
 
Looks like I have some work to do eh?

Thanks for the code.

Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Thanks cmm,

Works like a champ.

Thanks, Rib

Bartender:Hey aren't you that rope I threw out an hour ago?

Rope:No, I'm a frayed knot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top