home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 January
/
pcwk_01_1999_B.iso
/
Lotus123
/
GERMAN
/
LOTUS006.DSK
/
SCRIPTS
/
CONN2.TPL
< prev
next >
Wrap
Text File
|
1996-10-09
|
3KB
|
70 lines
'Notes connect
'Declare my variables
Dim con As New Connection
Dim qry As New Query
Dim rs As New ResultSet
Dim c As Integer
'Make my connection:
'In this example we are connecting to Lotus Notes-Server to the sample database CALLTRAK.NSF
'The two empty parameters after the datasource type are for userid and password
'If we leave those out, as in this case, we will get prompted by Notes for the password
'associated with the local userid file.
'The fourth parameter is the syntax for the connection string to the server and the database name
'To determine the correct server name, choose File/Open. Under Files of Type, choose Lotus Notes - Server (*).
'In the Open dialogue, a list of valid server names will appear.
'The server used in this example appears as follows:
'CN=Approach_OU=SJC_OU=A_O=Lotus
'In the Approach script, the server name must be modified to appear as follows:
'CN=Approach/OU=SJC/OU=A/O=Lotus
'A forward slash must replace any underscores in the server name.
'The server name precedes the database name. An exclamation point is used as a separator between the
'server and database names. The path specified for the database is the same path that is shown in the open
'dialogue.
If con.ConnectTo ("Lotus Notes - Server", , , "CN=Approach/OU=SJC/OU=A/O=Lotus!EXAMPLES\CALLTRAK.NSF") Then
Set qry.Connection = con
'Define the view or form to be opened
'In this case we choose User Profile from the Call Tracking database
'To determine the form name, go to Notes - open the form in design mode.
'In the infobox the Name will be listed as
' 2. User Profile | UP
'The valid name is after the pipe (|).
qry.Tablename = "UP"
Set rs.Query = qry
'If the query was successful
If ((rs.Execute)<>False) Then
'Get all of the column names used in the Notes form:
c = 1 'Counter must start at 1 to retreive the column names
While c <= rs.numcolumns
Print rs.fieldname(c)
c=c+1
Wend
'End of retreiving column names
rs.FirstRow
c = 1 ' Counter must start at 1 to retreive values
While c <= rs.numrows
'Create a new record in Approach
CurrentDocument.window.newrecord
'Place the contents of the field "Organization" from my Notes form to
'my Approach field, named "org" on the form "Form1"
CurrentDocument.Form1.body.org.text = rs.Getvalue("Organization")
'Go to the next row of data in Notes
rs.nextrow
c = c + 1
Wend
'Otherwise let me know that there was a problem connecting
Else
Messagebox "The query did not run successfully.", 0, "Query Execution"
End If
'Must disconnect here - otherwise there may be problems reconnecting later
CON.DISCONNECT
End If