View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Bryan Dickerson Bryan Dickerson is offline
external usenet poster
 
Posts: 42
Default Newbie at mixing ADO and Excel

Ok, thru lots of time away from the VBA, I think I've made progress, but I
still have errors. The progress is that getting to the point of
"oCommand.Execute" with "EXEC SPReport 'ABC123', '2004-12-01', '2004-12-31'"
in the oCommand.Text works and even the Execute method works (or at least
doesn't return an error). But I put a breakpoint at the next statement:
Worsheet("Sheet1").Range("A1").CopyFromRecordset oRS" and did some playing
with the oRS object. When I put "? oRS.Fields.Count" it gave me the error
message: "Run-time error '3704' Operation is not allowed when the object is
closed." Hmmm....??? I'm currently still even in break mode on the VBA and
any attempt to display any properties or execute any methods on the oRS
object produces this error. Strange. This is my 1 remaining piece to the
puzzle for this project. NE1 got NE ideas??

Thanx!

"Bryan Dickerson" wrote in message
...
You are correct in that all of the parameters are text and should be
enclosed in single quote marks in the actual query.

"onedaywhen" wrote in message
ups.com...

Bryan Dickerson wrote:
When I
just run the actual query outside of the SP, I put the dates in

single
quotes ('), 'cause that's what works. When I pass the date strings

in to
the SP, I pass them in with single quotes around them, so my question

is, do
the single quotes become part of the query?


Just to clarify, I'd expect the command text to look like this:

EXEC SPReport 'ABC123', '2004-12-01', '2004-12-31'

This assumes customer number is text; if it is numeric, don't put the
value in quotes.

Jamie.

--