Hvala na ideji, pomogla mi je da dodjem do drugog resenja koje sam nasao na intenetu na
www.abstractvb.com
Evo koda sa njega, s tim sto u kodu treba isjkljuciti liniju
dlViewConnection.hWnd = UserDocument.hWnd
na dva mesta.
You will need to add a reference to the Microsoft OLE DB Service Component 1.0 Type Library. (OLEDB32.DLL) This file can be found in your Program Files\Common Files\System\OLE DB directory.
Add this function to your project and pass it a string. If the string is empty it brings up the ADO DB Connection Window in Add mode, if it is not empty it brings it up in edit mode.
Private Function ModifyConnection(ByVal ConnectionString As String) As String
Dim cnTmp As ADODB.Connection
Dim dlViewConnection As MSDASC.DataLinks
On Error GoTo ErrHandler:
If Not (Trim$(ConnectionString) = "") Then
Set cnTmp = New ADODB.Connection
cnTmp.ConnectionString = ConnectionString
Set dlViewConnection = New MSDASC.DataLinks
dlViewConnection.hWnd = UserDocument.hWnd
If dlViewConnection.PromptEdit(cnTmp) Then
ModifyConnection = cnTmp.ConnectionString
Else
ModifyConnection = ConnectionString
End If
Set dlViewConnection = Nothing
Set cnTmp = Nothing
Else
Set dlViewConnection = New MSDASC.DataLinks
dlViewConnection.hWnd = UserDocument.hWnd
Set cnTmp = dlViewConnection.PromptNew
ModifyConnection = cnTmp.ConnectionString
Set dlViewConnection = Nothing
Set cnTmp = Nothing
End If
Exit Function
ErrHandler:
If Err.Number = (-2147217805) Then
cnTmp.ConnectionString = ""
Resume
End If
Set cnTmp = Nothing
Set dlViewConnection = Nothing
End Function