PC Review


Reply
Thread Tools Rate Thread

access database (adodb)from excel vba

 
 
=?Utf-8?B?QXNrRXhjZWw=?=
Guest
Posts: n/a
 
      17th Jul 2006
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access from Excel ADODB.Connection Pictou Microsoft Excel Programming 1 5th Aug 2008 05:56 PM
ADODB Create New Database from Excel =?Utf-8?B?Q2xheW1hbg==?= Microsoft Excel Programming 2 16th Jul 2007 04:32 PM
Access to Excel Automation ADODB Problem Matt Slattery Microsoft Excel Programming 2 29th Sep 2004 12:59 PM
Access and excel - ADODB =?Utf-8?B?ZmVybmFuZG8=?= Microsoft Access Getting Started 0 10th Jun 2004 06:07 AM
Export from Excel to Access ADODB javydreamercsw Microsoft Excel Programming 2 19th Feb 2004 09:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 PM.