473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access 2003 form bound to a fabricated ADO recordset: problem with sorting and filtering

Hello,

Here is a sample (and very simple) code that binds an Access 2003 form
to a fabricated ADO recordset:

' Create recordset...
Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset

' Append one or more fields...
Call rs.Fields.Append("Number", adInteger)

' Open recordset and add a few records...
Call rs.Open
Dim num as Integer
For num = 1 to 10
Call rs.AddNew
rs("Number") = num
Call rs.Update
Next
Call rs.UpdateBatch

' Bind the form to the recordset...
Set Me.Recordset = rs

This seemed to make everything work just fine until I've discovered
that form-level sorting and filtering with such recordset does not
work. Worse yet, it makes Access 2003 fail miserably (like a GPF in
old-good days).

Accidentally, our team discovered that the abovementioned problem goes
away entirely if you do the following trick: after appending the
fields to the recordset and before opening it, assign some non-blank
string to the recordset's Source property. Interestingly enough, the
contents of this string almost does not matter. For example, if you
add the following line just before a call to rs.Open:

rs.Source = "Microsoft Access Sucks"

Tada! Now the form can be sorted and filtered without a hitch. Single
character string also works fine. (Based on some experiments, it looks
like any string would do so long as it looks like a valid SQL
statement after a very superficial syntactic check by Access.)

The abovementioned hack (or cheat) is easy and may be funny, but... it
is still looks, smells, and tastes as a hack. Although it does help
with sorting and filtering, it may leave other issues (yet unknown to
us) unresolved or maybe even induce some new issues. So I am wondering
if anyone experienced the same problem and knows a solution better
than the trick described above?

Thnak you,
Yarik.

Sep 27 '07 #1
0 3108

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
6
by: AAJ | last post by:
Hi all I have a listbox on a form. If I set its rowsource directly, and the query in the rowsourse returns no data, then the displayed listbox is empty (exactly as you would expect) ...
21
by: Madingo | last post by:
I have been using Access 2003 for about a year and I am trying to find out how to create a web test environment to try and transition some of my Access applications on to the web. My stumbling...
42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
24
by: Bob Alston | last post by:
Most of my Access database implementations have been fairly small in terms of data volume and number of concurrent users. So far I haven't had performance issues to worry about. <knock on wood> ...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
3
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be...
6
by: jsacrey | last post by:
Hello everybody, I've got a bit of a situation that I could use some guidance with if possible. I work for an auditing firm where my users audit electronic shipping data for customers to see if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.