Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This Action was canceled by an associated object (error #3426)

Status
Not open for further replies.

JesseV

Programmer
Dec 26, 1999
1
US
The above error keeps popping up when I try to add a new record the access database connected to my vb6 program.<br>
<br>
The debugger points to the line of code &quot;datUser.addnew&quot; as being the problem. datUser is the name of the data control connecting the database program and the program. Any ideas on what is causing this?<br>
<br>
Jesse
 
Yeah paste some code right here so we can have a look.<br>
Here's something to do also<br>
Do you have VB6 Pro or higher?<br>
If so use the Data Wizard to create a form to your Access database<br>
It will create several button to add, delete, and update records<br>
Look at what it writes for the correct syntax.<br>

 
Private Sub cmdAdd_Click()<br>
On Error GoTo AddErr<br>
datPrimaryRS.Recordset.AddNew<br>
<br>
Exit Sub<br>
AddErr:<br>
MsgBox Err.Description<br>
End Sub<br>
<br>
Here is a sample of what the data Form wizard created for Adding a new record.<br>
<br>
click Add-Ins, AddIn Manager, find Data form Wizard in the list.<br>
Next click the Loaded/unloaded radio button in the lower right.<br>
It will show up when you click Add-Ins again.<br>

 
This error is being generated because the AddNew command of a bound recordset causes Visual Basic to try to save the current record if the data has changed. Because the data control is currently pointing to a NULL record and not an empty record, the data cannot be saved so the &quot;action was cancelled by an associated object&quot; error is reported. This is commonly seen when using the data form wizard in Visual Basic versions 4.0 and 5.0. The data form wizard in Visual Basic 6.0 generates code for the ADO data control so this error is less likely to occur. <br>
<br>
<br>
<p>Eric De Decker<br><a href=mailto:vbg.be@vbgroup.nl>vbg.be@vbgroup.nl</a><br><a href= Visual Basic Center</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top