Query in recordset, impossible.

patrickd123

Patrickd123
Local time
Today, 18:16
Joined
Jan 21, 2007
Messages
29
sqlstr = "SELECT * FROM 06JobSchedule"
rs.Open sqlstr, Cnxn, adOpenStatic, adLockReadOnly, adCmdText

Why these statements gets an error( 06JobSchedule is a quey). And if change 06JobSchedule by Shedule(which is a table), it works! Is it to say that I cannot select on queries and only in tables?

(I use SQl server 2005)
 
You can select from a query. I would probably use

rs.Open "06JobSchedule", Cnxn, adOpenStatic, adLockReadOnly, adcmdstoredproc

But you don't tell us what the error is.

The usual, is that the query contains parameters, and in such case the parameters need to be resolved. The other, is if the query contains VBA or user defined functions, which I don't think is possible.

Give us the SQL of the query, and the errormessage, and will see what we can do.
 
Well, Indeed I had another post in another section which was that I could not use parameter in the query in question. Nothing I read on query parameter in this forum seemed to work. Well I just tried a parameter query in a MDB instead of a ADP and it works!!!. So I guess my question is now, how can I pass information to a query in a ADP with SQL SERVER 2005?
 
Several ways.

One is to use the parameters collection of an ADO Command object, but there are other methods, too.
 

Users who are viewing this thread

Back
Top Bottom