If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > ADO Connection and linked tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-04-07, 04:57
Donmacdon Donmacdon is offline
Registered User
 
Join Date: Nov 2002
Posts: 4
ADO Connection and linked tables

Hi

I'm trying to run a routine from Excel that populates a spreadsheet by creating an ADODB connection to an Access database and opening an exsting query.

This query contains a couple of tables that are linked into the Access database from other databases.

When I run the routine I get the error message "Too few paramaters. Expected 1". Interestingly if I try to run the routine locally or against tables that aren't linked tables, then it works OK.
I've also tried DAO with the same result.

Anyone know if there are any problems with ADO or DAO connections when the tables being used are actually linked tables?

I know the above way of doing things isn't the best and it would be easier to produce the spreadsheet from the Access database, but it seems that thats the way they want things round here...

Any thoughts appreciated.
Reply With Quote
  #2 (permalink)  
Old 07-04-07, 07:57
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
Hi

Use this technique all the time (with ADO) and have had no problems (I coudn't fix!), almost all errors with that message I encounter are errors in the query string.

However, I normally connect to the backend (its faster) and define the query string in Excel.

How is the recordset opened in Excel, for instance is it

rs.Open "qryYourQuery", connection

or somthing like

rs.Open "SELECT * FROM qryYourQuery WHERE FieldName = xxx", connection

In either case what is the query stored in the DB, does it have parameters?

MTB
Reply With Quote
  #3 (permalink)  
Old 07-04-07, 11:12
Donmacdon Donmacdon is offline
Registered User
 
Join Date: Nov 2002
Posts: 4
Hi Mike - thanks for the reply.

After I posted originally I went back and re-examined the query, and realised that there was a significant field missing. The query was composed of other queries, so the error was slightly hidden, but I should have spotted it.

I think part of the problem was that I was told to have a look at this, and that the problem was to do with the linked tables....should have examined everything myself from the start.

Thanks for your reply, it certainly helped.

Cheers
Don
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On