Am Wed, 8 Nov 2006 13:39:01 -0800 schrieb bell2:
Hello, Does publisher work with Oracle 9i? Can we create mailing labels
in publisher by connecting to oracle and retrieving the data in its
tables?
Well, I'm not sure whether this is an option for you (couldn't make out if
you wanted something in vba), but maybe it helps. I'm not familiar with
oracle 9i, but here is an example that retrieves data from an Access-MDB
(note that this is a very simple example and these are testdata of course):
Sub VerbindungMDB()
Dim cnn As ADODB.Connection
Dim rec As ADODB.Recordset
Set cnn = New ADODB.Connection
With cnn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=FullPathToMDB;User Id=admin;Password=;"
.Open
End With
Set rec = New ADODB.Recordset
rec.Open "SELECT * FROM Tabelle1 WHERE Testname = ""Hansen""", cnn, adOpenKeyset, adLockOptimistic
ThisDocument.Pages(1).Shapes(1).TextFrame.TextRange.InsertAfter rec.Fields(1).Value
Set rec = Nothing
Set cnn = Nothing
End Sub
What you need for oracle is the correct connectionstring, have a look here:
http://www.connectionstrings.com/
Plus you need to set a reference to the Microsoft ActiveX Data Objects 2.x
Library (at least 2.7 SP1)
I've tested this little code here with Publisher 2002 and it works.
HTH
Greetings
Susanne