Annoying item on subform edit

  • Thread starter Thread starter Kyle Jedrusiak
  • Start date Start date
K

Kyle Jedrusiak

In the program I build a sql query string on the fly.

From that I generate an ADODB.Recordset.

I open a master form with a subform. In the subform's Open event I set it
recordset to the one generated above. The subform is set to continuous
forms.

All is OK to start with, however, if the user edits any value(s) on a record
then clicks on a different record, the one that was edited disapears from
the screen and the recordset (the number of total records goes down by one!)

Where have I gon wrong?

Kyle!
 
When you set the Tecordset property of a form, you must strictly follow
certain rules, or Access will misbehave, or even crash.

First of all, the recordset must be using the same ADO povider that Access
uses. I don't recall what it is off the top of my head, but it's a wrapper
providor around the MS SQL Server driver. The easiest way to make sure this
happens is to always use the CurrentProject.Connection connection.

Next, the recordset must be of the correct type. It must be Static with the
Client side cursors, with Optimistic locking.

Finally, almost anything you do to the recordset such as filter it, etc., will
confuse Access. That's true whether you do it before setting the form's
recordsource property, or after.
 
Back
Top