You will need to set a reference to "Microsoft OLE DB Service Component 1.0 Type library" and then you can call up the dialog like this.
VB Code:
Option Explicit Private Sub cmdConn_Click() MsgBox BuildConnectionString End Sub Private Function BuildConnectionString() As String Dim objLink As MSDASC.DataLinks Dim strConn As String On Error Resume Next ' Display the dialog Set objLink = New MSDASC.DataLinks strConn = objLink.PromptNew If Err.Number = 0 Then ' Create a Connection object on this connection string BuildConnectionString = strConn Else ' User canceled the operation BuildConnectionString = "" End If Set objLink = Nothing End Function




Reply With Quote