ACC2000: Text Box in Form Header or Footer Displays Previous Record When You Move Through Records
ID: Q232294
|
The information in this article applies to:
This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).
Novice: Requires knowledge of the user interface on single-user computers.
SYMPTOMS
A text box in a header or footer of a form displays the previous values as you move forward and backward through the records.
CAUSE
When you click the navigation buttons in Form view to move forward and backward through the records, a text box in the header or footer of the form displays the value of the previous record when the following two conditions are true:
-
The textbox in the header or footer has the focus as you move through the records.
- The EnterKeyBehavior property of this text box is set to New Line in Field.
RESOLUTION
In the Current event of the form, use Visual Basic for Applications code to repaint the screen. To do so, follow these steps:
- Open your form in Design view.
- On the Edit menu, click Select Form.
- On the View menu, click Properties.
- In the Form property sheet, click the Event tab, click in the OnCurrent property box, click the Build (...) button, click Code Builder, and then click OK.
- Type the following code:
Private Sub Form_Current()
Me.Recalc
End Sub
- Save your changes and view the form.
MORE INFORMATIONCAUTION: 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 Access database file Northwind.mdb or the sample Access project file NorthwindCS.adp.
- Click Tables under Objects, and then click the Shippers table.
- On the Insert menu, click AutoForm.
- On the View menu, click Design View.
- If the AutoForm Wizard included a subform in the design of the form, delete it.
- On the View menu, click Form Header/Footer.
- Click the CompanyName text box, and then click Cut on the Edit menu.
- Click in the form header section, and then click Paste on the Edit menu.
- Click the Phone text box, and then click Cut on the Edit menu.
- Click in the form footer section, and then click Paste on the Edit menu.
- Set the Height property of the detail section to 0.5".
- Hold down the SHIFT key, and then click in the CompanyName and Phone text boxes.
- Set the EnterKeyBehavior property to New Line in Field.
- On the View menu, click Form View.
- Move forward and backward through the records and note how the CompanyName and Phone values change accordingly.
- Move back to the first record, and then place the mouse pointer in the CompanyName text box.
- Move forward and backward through the records and note how the CompanyName value remains out of synch by one record.
Additional query words:
prb
Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
|