Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
hi all,
may i know the follow to connect to database able to define in VBA (excel)? i tried to use but when run i got the message compile error: user defined type not defined at Dim rstest as adodb.recordset if this cannot be done in VBA, what is the alternative to access database from excel? please advise. thank you very much Public cnsql As ADODB.Connection Sub Main() Set cnsql = New ADODB.Connection With cnsql ..Provider = "xx;" & _ "Data Source=xx;" & _ "Initial Catalog=xx;" & _ "User Id=xx;" & _ "Password=xx" ..Open End With End Sub private sub Dim rstest As ADODB.Recordset Set rstest = New ADODB.Recordset With rstest ..ActiveConnection = xx ..CursorType = adOpenKeyset ..LockType = adLockOptimistic ..Open "sql statement"'" End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing EXCEL Spreadsheets into ACCESS -- Macro or VBA? | Excel Discussion (Misc queries) | |||
Linking Large Access Table into Excel | Links and Linking in Excel | |||
Updating Excel forecasts into an Access Database | Excel Worksheet Functions | |||
Using Access database to "populate" Excel Sheets | Excel Discussion (Misc queries) | |||
Changing the format of an Excel output file made by Microsoft Access | Excel Discussion (Misc queries) |