Microsoft KB Archive/149097

= BUG: Data Control Validate Event Not Fired on Unloading Form =

Article ID: 149097

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q149097



SYMPTOMS
A form containing a bound Data Control disables the Validate event when the form is unloaded.



STATUS
Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The following are steps to reproduce this behavior. The Cancel property is set to true in the Unload event of the form to prevent the form from unloading. When you edit a record and then unload the form, the validate event, containing a beep instruction, executes only one more time.

Steps to Reproduce Behavior
 Start 16-bit or 32-bit Visual Basic 4.0, or if it is already running, click New Project on the File menu.  Add the following controls and set the following properties:      Control              Default Name   Property              Value

Data Control           Data1       Database Name         BIBLIO.MDB RecordSource         Authors

TextBox Control        Text1       DataSource            Data1 DataField            Author

Command Button         Command1   Copy the following code to the Code window of the Form1 form: Option Explicit

Private Sub Command1_Click Unload Me     End Sub

Private Sub Data1_Validate(Action As Integer, Save As Integer) Beep End Sub

Private Sub Form_Unload(Cancel As Integer) 'The next line stops the form from being unloaded Cancel = True End Sub  On the Run menu, click Start or press the F5 key to start the program. Scroll through the records and click the command button. Note that a beep occurs with each action. Edit a record and click the command button. Scroll through the records and note the a beep occurs only once. Scrolling through the records or clicking the command button does not execute the Validate event.</ol>

Additional query words: 4.00 vb4win vb4all

Keywords: kbbug KB149097

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.