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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Tables via VBA

Status
Not open for further replies.

rpbenito

Programmer
Jun 13, 2001
63
US
How do I link tables using Files DSN's via VBA? Thanks
 
This is one I use

Dim Conn2 As ADODB.Connection, rst As ADODB.Recordset, SQLcode2 As String
Set Conn2 = New ADODB.Connection
Conn2.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=COMPX;" 'our DSN is called “COMPX”
SQLcode2 = "SELECT * From .... ;"
' Open Employee table.
Set rst = New ADODB.Recordset
rst.Open SQLcode2, Conn2, , , adCmdText

‘ do normal rst. Or rst! Stuff
‘x = rst!yourfield
‘ or rst.Movefirst

set rst = nothing
set conn2 = nothing
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top