Domino Code Fragment

Code Name*
Create new Data Source for text file
Date*
01/15/1999
Source (or email address if you prefer)*
Mackie
IP address:.3.147.42.168
Description*
Put in button to create new data source automatically
Type*
LotusScript
Categories*
Reporting/Searching
Implementation:
None (plug and play)
Required Client:
(none)
Server:
(none)
Limitations:
Comments:
Put in button to create new data source automatically
Files/Graphics attachments (if applicable): Code:
Declarations
Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL"(Byval hwndParent As Long, Byval fRequest As Long, Byval lpszDriver As String, Byval lpszAttributes As String)  As Long
_________________________
Sub Click(Source As Button)
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Set uidoc = workspace.CurrentDocument
     
     Dim doc As NotesDocument
     Dim item As NotesItem
     
' * Code to create a new datasource for an Text file.   *
'  * First you need to use the Declare DLL function to prototype the SQLConfigDataSource function   ***
' DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, Integer,String, String   ***
     
     settings = "DSN=ISOTEXT" + Chr(0) + ";" & _
     "Description=E&C Sales Text File" + Chr(0) + ";" & _
     "FIL=Text" + Chr(0) + ";" & _
     "DefaultDIR=C:\ecrep" + Chr(0) + ";" & _
     "Extensions=txt"
 '* Note: If you have spaces on either side of the equal  
     Print SQLConfigDataSource(0,1,"Microsoft Text Driver (*.txt; *.csv)",settings)
     Msgbox "Data Source Name 'ISOTEXT' configured."
 '...set value of doc...
     Call uidoc.FieldSetText ( "DSNOK", "Yes" )
     Call uidoc.Refresh
     Call uidoc.Save
     
End Sub