Link to home
Start Free TrialLog in
Avatar of adspmo
adspmo

asked on

Accessing ODBC via an Agent

Hi Guys

Can Notes initiate an Agent the will open a ODBC coonction to Access under certain circumsatances and exchange data

I have a link,Using File-Get External Data-Link  in Access

Avatar of p_partha
p_partha

Here is a preliminary code

Put this in ur options:

Uselsx "*LSXODBC"




Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
' Connect to the datasource
If Not con.ConnectTo("OurODBCSource") Then ' here give your odbc name
Messagebox "Could not connect ",, "Error connecting"
Exit Sub
End If
' Set up the odbc objects
Set qry.Connection = con
Set result.Query = qry

qry.SQL = "SELECT * FROM <your tablename>"


' and execute the query - and wait for the result set to fill up with data
result.Execute

' Now roll through each row of the result set and create a new document in our database for each row in the table
If result.IsResultSetAvailable Then
Do
result.NextRow

msgbox result.getvalue("name")
Loop Until result.IsEndOfData
result.Close(DB_CLOSE)

End If

' Close the connection to the ODBC Source
con.Disconnect



Partha
Yes, Notes can.  Agents can use LCLSX (better but harder) or LS:DO (easier but less flexible). Define a system DSN, then connect to it using either of the above.
FYI, Partha's *LSXODBC is the same as LS:DO.
ASKER CERTIFIED SOLUTION
Avatar of RanjeetRain
RanjeetRain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial