Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 19
Default access database (adodb)from excel vba

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing EXCEL Spreadsheets into ACCESS -- Macro or VBA? Excel Discussion (Misc queries) 0 July 12th 06 10:08 PM
Linking Large Access Table into Excel Steven M. Britton Links and Linking in Excel 1 December 30th 05 11:28 PM
Updating Excel forecasts into an Access Database Maree Maxfield Excel Worksheet Functions 1 December 7th 05 03:54 PM
Using Access database to "populate" Excel Sheets maacmaac Excel Discussion (Misc queries) 1 September 19th 05 05:06 PM
Changing the format of an Excel output file made by Microsoft Access Amir Excel Discussion (Misc queries) 2 May 1st 05 12:57 AM


All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"