Connection - ODBC

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Connection - ODBC

Post by D Willett »

Hi

I have a form with 3text controls.

Text1
Text2
Text3

I want to populate these texts with data from an ODBC source.
The data is a small table holding no more than 30 records of:

SiteCD ( Current Branch )
UserID ( Current User )
JobID ( Current Job I am Working On )

Without using any components adodc etc, can I populate these Text Controls?
( This is a start to a new login form for my project )
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Connection - ODBC

Post by HansV »

You can set a reference to one of the Microsoft ActiveX Data Objects m.n libraries, and open an ADODB connection and an ADODB recordset. You can then set the value of the text boxes to the value of fields in the recordset. Don't forget to close the recordset and connection when you don't need them anymore.

See ADO Connection String Samples or The Connection String Reference for examples of the connection string you need to open an ADODB connection to various kinds of data sources.
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Connection - ODBC

Post by D Willett »

Cheers Hans

Some useful information there.

Regards
Cheers ...

Dave.