A
alan_conoco
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\ayleta\My Documents\TGW
Trade Query;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
Excel 2000
Access 2000
Many thanks
Alan
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\ayleta\My Documents\TGW
Trade Query;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
Excel 2000
Access 2000
Many thanks
Alan