|
Subject:
|
ADO/SQL Server RecordSet and the OrderBy Property
|
|
Posted By:
|
Dataman
|
Post Date:
|
2/7/2004 11:00:27 PM
|
Hi there, I have an issues and can't seem to find any info on the web about it. Here is what I'm doing.
1. Open a Recordset using ADO via a stored proc in SQL Server. 2. Set the forms recordset = to the ado recordset.
This works, not problems here.
I want to set the OrderBy property to a preset string. This works if the form has not been bound to the ADO recordset, but if the form is bound and I change orderby and change the orderbyon property to true, I get the error "Data provider could not be initialized." Has anyone ran across this before.
Currently, I'm killing the datasource for the form, and then reattaching the recordset...seems like a lot of work.
One other note. The form is in datasheet view and if I use the mouse and the popup menu to change the sort order (orderby property) it works...it's the same value that I'm setting it to programatically.
Thanks in advance, Mike
|
|
Reply By:
|
pinkandthebrain
|
Reply Date:
|
2/8/2004 1:15:00 PM
|
I don't believe the SQL is reset after attaching the recordset. I get around this by setting the SQL directly to the recordsource property of the form:
me.Recordsource = "SELECT * FROM xxx WHERE xxx ORDER BY xxx"
|
|
Reply By:
|
Dataman
|
Reply Date:
|
2/8/2004 9:19:56 PM
|
If you set the form's record source to a SQL statement, don't the tables have to be local?
Mike
|
|
Reply By:
|
Dataman
|
Reply Date:
|
2/9/2004 10:11:46 AM
|
If you set the form's record source to a SQL statement, don't the tables have to be local? Doesn't that kind of negate using an ADO recordset that returns values fro SQL Server?
Mike
|