#define ODBC_ADD_DSN 1 #define ODBC_ADD_SYS_DSN 4 Declare Long SQLConfigDataSource In ODBCCP32.DLL ; Long hwndParent, Long fRequest, String lpszDriver, String lpszAttributes strDriver = "Microsoft Access Driver (*.mdb)" strAttributes = "DESCRIPTION=Temp DSN" + Chr(0) strAttributes = strAttributes + "DSN=DSN_TEMP" + Chr(0) strAttributes = strAttributes + "DBQ=E:\new.mdb" + Chr(0) strAttributes = strAttributes + "DriverId=281" + Chr(0) strAttributes = strAttributes + "FIL=MS Access" + Chr(0) strAttributes = strAttributes + "MaxBufferSize=2048" + Chr(0) strAttributes = strAttributes + "PageTimeout=5" + Chr(0) strAttributes = strAttributes + "SystemDB=E:\Program Files\Microsoft Office\Office\SYSTEM.MDW" + Chr(0) strAttributes = strAttributes + "UID=Admin" + Chr(0) strAttributes = strAttributes + "PWD=password" + Chr(0) intRet = SQLConfigDataSource(0, ODBC_ADD_DSN, @strDriver, @strAttributes) If intRet = 0 MessageBox("DSN Create Failed") EndIf