BUG: DAO Recordset Update Method Fails Silently (242459)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q242459 SYMPTOMS
When you attempt to add a new record to a recordset, the Data Access Objects (DAO) Recordset Update method may fail silently when the following conditions are met:
- The Recordset is based on a query that joins two tables.
- The table being updated has a Required field enforced by a Primary Key or Unique Index.
- No values are supplied for any of the fields in the Recordset.
RESOLUTION
To work around this problem, use either of the following methods:
- If the joined table is unnecessary, remove the joined table from the query. Doing this causes the 3314 error to fire as expected. To remove the joined table:
- Open the database in Microsoft Access.
- Open the query in Design View.
- Delete the unnecessary table from the query.
- Save and close the query.
Prior to calling the Update method, write code that checks to ensure that a value is supplied for all fields in the table where the Required Value property is set to Yes. For example, if you are using text boxes on a form for data entry and you have a text box named txtSSN and a required field in the table named SSN, check the Text property of the txtSSN text box prior to calling the Update method to ensure it contains a value as follows:
If Trim(txtSSN.Text) = "" Then
MsgBox "The SSN field is Required. You must supply a valid SSN."
txtSSN.SetFocus
Exit Sub
End If
- Prior to calling the Update method, write code that checks to ensure that a value is supplied for all fields in the table where the Required Value property is set to Yes. For example, if you are using text boxes on a form for data entry and you have a text box named txtSSN and a required field in the table named SSN, check the Text property of the txtSSN text box prior to calling the Update method to ensure it contains a value as follows:
If Trim(txtSSN.Text) = "" Then
MsgBox "The SSN field is Required. You must supply a valid SSN."
txtSSN.SetFocus
Exit Sub
End If
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/15/2002 |
---|
Keywords: | kbBug kbDatabase kbDSupport KB242459 |
---|
|