RE:Llamada ventana origen de datos ODBC
te mando el proceso y las api´s que utiliza:
'*********************************************************'
' Se llena el combo con los ODBC's que hay en el pc '
'*********************************************************'
Private Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv&, ByVal fDirection%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDescription$, ByVal cbDescriptionMax%, pcbDescription%) As Integer
Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
Sub sub_GetDSNsAndDrivers()
Dim intI As Integer
Dim strDNSItem As String * 1024
Dim strDRVItem As String * 1024
Dim strDNS As String
Dim strDRV As String
Dim intDSNLen As Integer
Dim intDRVLen As Integer
Dim lngHenv As Long 'controlador de entorno
On Error Resume Next
'Pongo valor por defecto
cmbDSNList.AddItem "(Ninguno)"
'obtener los DSN
If SQLAllocEnv(lngHenv) <> -1 Then
Do Until intI <> SQL_SUCCESS
strDNSItem = Space$(1024)
strDRVItem = Space$(1024)
intI = SQLDataSources(lngHenv, SQL_FETCH_NEXT, strDNSItem, 1024, intDSNLen, strDRVItem, 1024, intDRVLen)
strDNS = Left$(strDNSItem, intDSNLen)
strDRV = Left$(strDRVItem, intDRVLen)
If strDNS <> Space(intDSNLen) Then
cmbDSNList.AddItem strDNS
End If
Loop
End If
cmbDSNList.ListIndex = 0
blnPrimeraVez = False
blnModificadaODBCLogon = False
End Sub