View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] alan_conoco@hotmail.co.uk is offline
external usenet poster
 
Posts: 7
Default Help with using ADO to connect Excel to Access

The contents of the UDL file are detailed in the original post labeled
UDL String.


Bob Phillips wrote:
What's in the udl file?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
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