Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing User Name and Password using ODBC connection... 1

Status
Not open for further replies.

Rosti

Programmer
Mar 5, 2002
46
US
HI.
How can I pass user_name and password using ODBC connection to the Informix database and MS Acceess 2000 as a front end application?
Thanks in advance.
 
Please advise which version of Access you are using. The approach varies depending on the version
 
PeterDaniel, this is MS ACCESS 2000 Proffessional Edition.
Thanks.
wavey
 
Rosti,

You can use ADO methods to establish connection to your Informix database

Step 1: Assuming you have ODBC drivers setup for Informix on your system, define a System DSN. For our purposes here, we'll call your new DSN "MyInformix"

Step 2: Either in a module or the form that you wish to have accessing the Informix datasource, write the following function:

Public Sub getInformixData()

Dim Cnxn As ADODB.Connection
Dim rstMyTargetTable As ADODB.Recordset
Dim strSQLTarget As String


' Open a connection using a DSN and OLE DB tags
Set Cnxn = New ADODB.Connection
Cnxn.ConnectionString = "Data Source=MyInformix;User ID=sa;Password=pwd;"
Cnxn.Open


' Open Target Table
Set rstMyTargetTable = New ADODB.Recordset
strSQLTarget = "Insert Your Query Here"
rstMyTargetTable.Open strSQLTarget, Cnxn, adOpenKeyset, adLockOptimistic, adCmdTable

'you would do any manipulation of the data set here
'
'


rstMyTargetTable.Close
Cnxn.Close
Set rstMyTargetTable = Nothing
Set Cnxn = Nothing

End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top