LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with using ADO to connect Excel to Access

Hi,

I am new to ADO and am having problems getting a simple example to
work.

When the followig code is executed the 'rs.Orders.Open StrSQL, cn'
command throws 'Object recquired' exception. Neither strSQL or cn are
null, can anybody help??

Sub test()

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "File Name=\\lonfs01\users\ayleta\my documents\TGW Trade
Query\test.udl"


'Create the SQL statement that does all the work
strSQL = "SHAPE {SELECT TradeID, Product FROM TradesDone)"

'Create the recordset for the orders table
rsOrders.Open strSQL, cn

Do While Not rsOrders.EOF
'Print out the header rows, one at a time
Debug.Print rsOrders!TradeID, rsOrders!Product,

rsOrders.MoveNext
Loop

End Sub

UDL String:
Provider=MSDASQL.1;Persist Security Info=False;Mode=ReadWrite;Extended
Properties="DSN=MS Access Database;DBQ=\\lonfs2\users\ayleta\My
Documents\TGW Trade
Query\TGWTrades.mdb;DefaultDir=\\lonfs2\users\ayle ta\My Documents\TGW
Trade Query;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin; "

Excel 2000
Access 2000

Many thanks

Alan

 
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
connect excel form to access table sam Excel Discussion (Misc queries) 2 June 30th 09 05:24 PM
How do I connect to access 2007 data from excel? Marilyn Myers Excel Discussion (Misc queries) 3 December 12th 08 04:15 PM
Connect to Access Database On Remote Server UT Excel Discussion (Misc queries) 0 August 21st 07 10:42 PM
connect to access database and run a query in excel VBA Bob Excel Discussion (Misc queries) 0 April 25th 06 08:12 PM
ADO Connect Access gti_jobert[_78_] Excel Programming 5 April 4th 06 01:24 PM


All times are GMT +1. The time now is 08:44 AM.

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

About Us

"It's about Microsoft Excel"