ACC2000: Setting Form Recordset Causes Dirty Record to Commit
ID: Q223224
|
The information in this article applies to:
This article applies only to a Microsoft Access database (.mdb).
Advanced: Requires expert coding, interoperability, and multiuser skills.
SYMPTOMS
If you have two forms open with the same record source, and you programmatically set the recordset of one form to be equal to the recordset of the second form, any edits you have made thus far on the second form are committed to the data source.
RESOLUTION
If you have two forms based on the same data source, do not set one form's recordset equal to the other during data entry.
MORE INFORMATION
CAUTION: Following the steps in this example will modify the sample
database Northwind.mdb. You may want to back up the Northwind.mdb file
and perform these steps on a copy of the database.
Steps to Reproduce Behavior
-
Open the sample database Northwind.mdb.
-
Create a form called Cat1 with the following characteristics:
Form: Cat1
------------------------
Caption: Cat1
RecordSource: Categories
Text Box
-------------------------
Name: CategoryID
ControlSource: CategoryID
Text Box
--------------------------
Name: Description
ControlSource: Description
-
Create a second form called Cat2 with the following characteristics:
Form: Cat2
-------------------------
Caption: TestForm
RecordSource: Categories
Text Box
-------------------------
Name: CategoryID
ControlSource: CategoryID
Text Box
--------------------------
Name: Description
ControlSource: Description
-
Open both forms in Form view, each on the first record.
-
In form Cat2, change the Description to the following text, and leave the pointer in the field. Do not press ENTER.
Beer, ales, teas, coffees, and soft drinks
-
Press CTRL+G to open the Immediate window.
-
Type the following in the Immediate window:
Set Forms("Cat1").Recordset = Forms("Cat2").Recordset
-
After pressing ENTER in the Immediate window, note that Description on the form Cat1 now has the text that you typed in Description of the form Cat2, even though you have not yet explicitly committed the change in the form Cat2.
-
Open the Categories table. Note the first record contains the text that you typed for the Description in the Cat2 form.
REFERENCES
For more information about the Recordset property, in the Visual
Basic Editor, click Microsoft Visual Basic Help on the
Help menu, type "recordset property" in the Office Assistant or
the Answer Wizard, and then click Search to view the topic.
Additional query words:
pra dirty
Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug