General discussion

Locked

Databaseconnection in VBA.

By hlj ·
How do I connect to a database (I.e. Exchange 5.5 or an Access database), gathering information like phonenumbers or addresses, and put it into a userform object like a textbox?? This need to be done without fields in a document and mailmerge!!!
App.: Word 2000.
Thx!!

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Databaseconnection in VBA.

by donq In reply to Databaseconnection in VBA ...

Your question (as explained) has MANY possibilities:

If you are connecting to an Access database use the DAO subset of VBA code to link with your data source.

If you are connecting to an ODBC database use the ADO subset of VBA code to link with your data source.

If you are attempting to gather more than one thing (many times) you will need many text bboxes each lonked with a unique data source object.

The actual code is very simple and reads much like

Dim db As Database
Set db =CurrentDb()

however only you know the names of the objects holding the "source" data and the name of your "target" field(s)??

Sorry I can't help more but you didn't provide ANY specifics.

Collapse -

Databaseconnection in VBA.

by hlj In reply to Databaseconnection in VBA ...

The question was auto-closed by TechRepublic

Collapse -

Databaseconnection in VBA.

by A.C In reply to Databaseconnection in VBA ...

DAO (Data Access Objects)

Use the OpenDatabase method to connect to a database and open it. After opening the database, use the OpenRecordset method to access a table or query for results. To navigate through the recordset, use the Move method.To find a specific record, use the Seek method. If you need only a subset of records instead of the entire recordset, use the CreateQueryDef method to design a customized query to select records that meet your criteria. When you finish working with a database, close it using the Close method.

Have a look at the VBA help, search for "database connection" and have a look at some of the example code

Collapse -

Databaseconnection in VBA.

by hlj In reply to Databaseconnection in VBA ...

The question was auto-closed by TechRepublic

Collapse -

Databaseconnection in VBA.

by hlj In reply to Databaseconnection in VBA ...

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums