800.682.0200 | FAX: 360.568.2923 |  About Us  |  Downloads  |  Manuals  |  Home  |  Index

 
 Middleware Applications
    JDBC JDBC/ UNIXMiddleMan ODBCODBC for Eloquence ODBC/UNIX OLE DB Provider for Image/Eloquence
   
News  

Minisoft News

Is your company legally licensed?

Press Release:
ODBC now supporting Eloquence, AIX, OSX, UNIX, LINUX, and Oracle Open Gateway for Heterogeneous Queries

 
Updates  

FREE Demo!

ODBC Updates

Summit HP3000 - Demo!

(Link to Summit's SOLV Information Page)

Summit Eloquence - Demo


Installing the ODBC Upgrade

Release Notes

ODBC Manual

 

 
Product Review  

ODBC Product Comparison

Customer Feedback

Latest Reviews

ODBC: The All-Terrain Database Tool

Product FAQ

Support FAQ

Checking Versions

 
See Also...

ODBC Application Samples

ODBC Downloadable Utilities


ODBC for UNIX

ODBC for Eloquence

ODBC on OSX

JDBC


MSJOB Information

 

  
  

 

MS Word Macro

Inserts an address from an Image database with ODBC.

code written by:
23. December 1997 / Thomas Isaak / Minisoft AG


Sub InsertAddress()

ActiveDocument.Save

Dim CustomerNr, SQLString, SQLString1

CustomerNr = InputBox("Enter Customer Number", "Insert Address")

If CustomerNr <> "" Then

  Set AdrDoc = Documents.Add

  SQLString = "SELECT CUSTOMERS.CUSTOMER_NAME, "&_
    "CUSTOMERS.ADDRESS1, CUSTOMERS.ADDRESS2," & _
    "CUSTOMERS.CITY, CUSTOMERS.STATE, CUSTOMERS.COUNTRY "

  SQLString1 = "FROM TESTSAV3.CUSTOMERS CUSTOMERS "&_
    "WHERE (CUSTOMERS.CUSTOMER_NUMBER='" & CustomerNr & "')"

  AdrDoc.Range.InsertDatabase Format:=0, Style:=0, _
    LinkToSource:=False, _
    Connection:="DSN=MSDB", _
    SQLStatement:=SQLString, SQLStatement1:=SQLString1, _
    PasswordDocument:="", PasswordTemplate:="", _
    WritePasswordDocument:="", WritePasswordTemplate:="", _
    DataSource:="", From:=-1, To:=-1, _
    IncludeFields:=False

  Set Table1 = AdrDoc.Tables(1)
  ReDim TabCells(Table1.Range.Cells.Count)
  i = 1
  For Each TabCell In Table1.Range.Cells
    Set CellRange = TabCell.Range
    CellRange.MoveEnd Unit:=wdCharacter, Count:=-1
    TabCells(i) = CellRange.Text
    i = i + 1
  Next TabCell

  AdrDoc.Close (wdDoNotSaveChanges)

' Insert CUSTOMER_NAME
  Selection.TypeParagraph
  Selection.MoveUp Unit:=wdLine, Count:=1
  Selection.Range.InsertBefore TabCells(1)
  Selection.MoveDown Unit:=wdLine, Count:=1


' Insert ADDRESS1
  Selection.TypeParagraph
  Selection.MoveUp Unit:=wdLine, Count:=1
  Selection.Range.InsertBefore TabCells(2)
  Selection.MoveDown Unit:=wdLine, Count:=1


' Insert ADDRESS2
  If TabCells(3) <> "" Then
    Selection.TypeParagraph
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.Range.InsertBefore TabCells(3)
    Selection.MoveDown Unit:=wdLine, Count:=1

  End If

' Insert CITY
  Selection.TypeParagraph
  Selection.MoveUp Unit:=wdLine, Count:=1
  Selection.Range.InsertBefore TabCells(4)
  Selection.MoveDown Unit:=wdLine, Count:=1


' Insert STATE
  Selection.TypeParagraph
  Selection.MoveUp Unit:=wdLine, Count:=1
  Selection.Range.InsertBefore TabCells(5)
  Selection.MoveDown Unit:=wdLine, Count:=1


' Insert COUNTRY
  Selection.TypeParagraph
  Selection.MoveUp Unit:=wdLine, Count:=1
  Selection.Range.InsertBefore TabCells(6)
  Selection.MoveDown Unit:=wdLine, Count:=1


End If

End Sub

   
 

Minisoft Inc.  1024 First Street Snohomish, WA 98290  Phone: (800) 682-0200  Fax: (360) 568-2923
 Copyright ©2008 Minisoft, Inc.   
License Agreement