Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 8th, 2004, 12:00 AM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO/SQL Server RecordSet and the OrderBy Property

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
  #2 (permalink)  
Old February 8th, 2004, 02:15 PM
Authorized User
 
Join Date: Jul 2003
Location: , , Canada.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"


  #3 (permalink)  
Old February 8th, 2004, 10:19 PM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you set the form's record source to a SQL statement, don't the tables have to be local?

Mike
  #4 (permalink)  
Old February 9th, 2004, 11:11 AM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
INSERT INTO from a SQL Server recordset? kcassidy Access 13 March 21st, 2006 08:35 AM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM
ADO Recordset and SQL Statements Dataman Access VBA 4 March 21st, 2004 06:19 PM
inserting utf-8 data using ado recordset to ms sql behrang79 Classic ASP Databases 0 September 29th, 2003 07:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.