Re: Data sources



I've come across the same problem when trying to connect to a database.
The reference you need is:

Microsoft ActiveX Data Objects 2.1 Library

Dan.

Mr. Smith wrote:
Nothing ticks me off more than when you copy a complete sub/function
straight out of an office VBA help example and it doesn't work. Grrrrr!!!!

Try this:

******************
Sub SetAndReturnDataSourceName()
Dim appOffice As Office.OfficeDataSourceObject

Set appOffice = Application.OfficeDataSourceObject

With appOffice
.Open bstrConnect:="DRIVER=SQL Server;SERVER=10.15.1.66\Refresh;" & _
"AdlerM=user;PWD=Eagle1234;DATABASE=Refresh",
bstrTable:="Employees"

If .DataSource = "" Then
.DataSource = "Refresh"
MsgBox .DataSource
End If
End With
End Sub
*****************************

I've tried it in PPT, Excel, and Word. They all fail on:

** Set appOffice = Application.OfficeDataSourceObject **

Reporting "Object does not supprt this method or property."

Fine. So what reference do I need to include? Come on MVP's!!


Mr. Smith

.



Relevant Pages

  • Re: Access 2003-Access 2002 Incompatibility
    ... Microsoft ActiveX Data Objects Recordset 2.7 Library ... The first one corresponds to msado15.dll (and adds the ADODB reference), ... There are two ADO type libraries. ...
    (microsoft.public.access.conversion)
  • RE: ADO/VBA
    ... I have a reference to Microsoft ActiveX Data Objects 2.8 Library. ... attempting this I keep gettig errors. ... Dim cn As New ADODB.Connection ...
    (microsoft.public.excel.programming)
  • Re: References
    ... Assuming that the other machine does indeed have ActiveX Data Objects installed, you can use code like the following. ... Dim Ref As Object ... I have distributed a spreadsheet which has a reference set to the ... with the missing reference, remove the MISSING reference and add a new ...
    (microsoft.public.excel.programming)
  • Re: Late Binding
    ... You can try unchecking the reference, ... need to add the Microsoft ActiveX Data Objects 2.7 Library reference back. ...
    (microsoft.public.access.queries)