Hi
Yes that is a good idea - Ill have a good read through tonight...
Sorry about that I re-posted and didn't know the time frame or the reply!
O sherbet! Ok
You see initially I used excel which was my first choice and I posted the
following in the excel programming group first:
***********************************************************************
Hi,
Im trying to connect to a sqlserver using this:
MyConnObj.Open _
"Provider = sqloledb;" & _
"Data Source={ServerName};" & _
"Initial Catalog={DatabaseName};" & _
"User ID={UserName};" & _
"Password={Password};"
But I am getting an error message:
Run-time error '-2147467259 (80004005)':
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied
I have got a System DSN which does connect to the database successfully. It
is using standard SQL server connection. If i could supply the system DSN Im
sure it would work?
Please help
Thanks
********************************************************************
but I could not connect to sql server getting the above error and being
reffered to
http://support.microsoft.com/kb/328306 , so i decided to use the
following from access:
Sub test()
Dim a As String
Dim xlApp As Excel.Application
Dim xlWrkbk As Excel.Workbook
Dim cn As ADODB.Connection
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column
Dim lRow As Long
a = "c:\jan.xls"
Set cn = CurrentProject.Connection
Set xlApp = CreateObject("Excel.Application")
Set xlWrkbk = xlApp.Workbooks.Open(a)
xlWrkbk.Application.Visible = True
cat.ActiveConnection = cn
lRow = 0
For Each tbl In cat.Tables
If tbl.Type = "TABLE" Then
For Each clm In tbl.Columns
lRow = lRow + 1
With ActiveSheet
.Cells(lRow, 1).Value = tbl.Name
.Cells(lRow, 2).Value = tbl.Type
.Cells(lRow, 3).Value = clm.Name
.Cells(lRow, 4).Value = clm.Type
.Cells(lRow, 5).Value = clm.DefinedSize
End With
Next
End If
Next tbl
xlWrkbk.Save
Set cn = Nothing
Set xlWrkbk = Nothing
End Sub
But it does not work with access 97! Please can you guys help me out with
the code using DAO ?
Thanks
Craig (My Name is Craig - Its a short story)