I have an access subform that used to have a recordsource of a SQL Server View. I am running into sorting issues with SQL Server 2005 and need to change the view to stored procedure. The stored procedure returns a sorted recordset without requiring any parameters. I change the recordsource on the subform to be the name of the stored procedure and kept all of the linking fields the same. The problem is that the subform now includes all the records in the database instead of only the records based on the master/sub link fields. Is there a way around this?
Linked fields work only with tables and views and not with stored procedures (SP); so you will have to use a parameterized SP or switch back to a view and sort/filter the view by writing a standard sql string for the record source in the OnCurrent event of the main form; something like: .RecordSource = "Select * from MyView " & " Order By MyField1" .... Also, the official newsgroup for ADP is m.p.access.adp.sqlserver. -- Sylvain Lafontaine, ing. MVP - Technologies Virtual-PC E-mail: sylvain aei ca (fill the blanks, no spam please) "Doug" wrote in message news:815B42A5-5233-47D3-92B2-DFF4D97A4CF8@microsoft.com... >I have an access subform that used to have a recordsource of a SQL Server > View. I am running into sorting issues with SQL Server 2005 and need to > change the view to stored procedure. The stored procedure returns a > sorted > recordset without requiring any parameters. I change the recordsource on > the > subform to be the name of the stored procedure and kept all of the linking > fields the same. The problem is that the subform now includes all the > records in the database instead of only the records based on the > master/sub > link fields. > > Is there a way around this?