Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
strSQL = "SHAPE {SELECT TradeID, Product FROM TradesDone)"
Check your brackets! MH 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good spot, but the brackets make no difference.
Any more ideas? MH wrote: strSQL = "SHAPE {SELECT TradeID, Product FROM TradesDone)" Check your brackets! MH 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
connect excel form to access table | Excel Discussion (Misc queries) | |||
How do I connect to access 2007 data from excel? | Excel Discussion (Misc queries) | |||
Connect to Access Database On Remote Server | Excel Discussion (Misc queries) | |||
connect to access database and run a query in excel VBA | Excel Discussion (Misc queries) | |||
ADO Connect Access | Excel Programming |