Not sure what this error means. (Error 3426) 
Author Message
 Not sure what this error means. (Error 3426)

I have a form based on a simple query. The query links two tables on one key
field named PerfID which gives a unique 6 character ID of the edited
person's record. When I run my code, I get Error 3426 - This action was
cancelled by an associated object.

I'm not clear on the meaning of the error message. Does anyone have advice
on where I can start debugging this one?

Hint: When I step through the code, it skips the .Edit line, goes to the
error, and will not allow me edit the record.

Thanks, Ed

P.S. I've put the important code below for your reference.

The sub below is called when the form is on a new record.

Private Sub CreatePerfID()

    Dim PerfID As String    'local variable for a unique PerformerID

    On Error GoTo DuplicatePerfID_Err

    PerfID = Left$(LastName, 4) & Left$(FirstName, 2)
    PerfID = StrConv(PerfID, vbUpperCase)

    With Me.Recordset
            .Edit
            'txtPerfID = PerfID ' txtPerfID is the text field on the form -
doesn't work
            .Fields("tblNewContactInfo.PerfID") = PerfID - this does not
work here because of the error. Worked elsewhere though.
            '.Fields("tblNewPerformerStatistics.PerfID") = PerfID - I tried
changing both PK and FK (what the hay, it might have worked :) )
            .Update
    End With

    Exit Sub

DuplicatePerfID_Err:
    If Err.Number = 3022 Then 'duplicate index or primary key values.
        MsgBox "You have a duplicate primary key!" ' I will make the last
character increment 1, 2, 3 in this case.
        Exit Sub
    Else
        MsgBox "Some unknown error " & vbCrLf & Err.Number & " " &
Err.description
        Exit Sub
    End If

End Sub



Mon, 03 May 2004 23:30:09 GMT  
 Not sure what this error means. (Error 3426)
Q189851:

CAUSE
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 "action was
cancelled by an associated object" 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.

RESOLUTION
Check the underlying recordset to see if either the BOF or EOF properties
are True before allowing an implicit save to occur. An implicit save occurs
either when using the data control to navigate off of a record where the
information has changed or adding a record to a bound recordset.


Quote:
> I have a form based on a simple query. The query links two tables on one
key
> field named PerfID which gives a unique 6 character ID of the edited
> person's record. When I run my code, I get Error 3426 - This action was
> cancelled by an associated object.

> I'm not clear on the meaning of the error message. Does anyone have advice
> on where I can start debugging this one?

> Hint: When I step through the code, it skips the .Edit line, goes to the
> error, and will not allow me edit the record.

> Thanks, Ed

> P.S. I've put the important code below for your reference.

> The sub below is called when the form is on a new record.

> Private Sub CreatePerfID()

>     Dim PerfID As String    'local variable for a unique PerformerID

>     On Error GoTo DuplicatePerfID_Err

>     PerfID = Left$(LastName, 4) & Left$(FirstName, 2)
>     PerfID = StrConv(PerfID, vbUpperCase)

>     With Me.Recordset
>             .Edit
>             'txtPerfID = PerfID ' txtPerfID is the text field on the
form -
> doesn't work
>             .Fields("tblNewContactInfo.PerfID") = PerfID - this does not
> work here because of the error. Worked elsewhere though.
>             '.Fields("tblNewPerformerStatistics.PerfID") = PerfID - I
tried
> changing both PK and FK (what the hay, it might have worked :) )
>             .Update
>     End With

>     Exit Sub

> DuplicatePerfID_Err:
>     If Err.Number = 3022 Then 'duplicate index or primary key values.
>         MsgBox "You have a duplicate primary key!" ' I will make the last
> character increment 1, 2, 3 in this case.
>         Exit Sub
>     Else
>         MsgBox "Some unknown error " & vbCrLf & Err.Number & " " &
> Err.description
>         Exit Sub
>     End If

> End Sub



Tue, 04 May 2004 06:42:18 GMT  
 Not sure what this error means. (Error 3426)

Thanks for the help Todd!

I solved the solution by checking the KB article you suggested and doing
a little bit of experimenting. I searched for this before, but couldn't
find it. Did you find this by searching the VB knowledge base? What
keywords did you search for?

Oh, in the end, the solution here was embarrassingly simple. Here it is:

    txtPerfID = PerfID

Where txtPerfID is a text field and PerfID was a field in a query. No
need to reference a recordset.

Thanks again, Ed Beliczynski

Quote:

>Q189851:

>CAUSE
>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 "action was
>cancelled by an associated object" 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.

>RESOLUTION
>Check the underlying recordset to see if either the BOF or EOF properties
>are True before allowing an implicit save to occur. An implicit save occurs
>either when using the data control to navigate off of a record where the
>information has changed or adding a record to a bound recordset.



>>I have a form based on a simple query. The query links two tables on one

>key

>>field named PerfID which gives a unique 6 character ID of the edited
>>person's record. When I run my code, I get Error 3426 - This action was
>>cancelled by an associated object.

>>I'm not clear on the meaning of the error message. Does anyone have advice
>>on where I can start debugging this one?

>>Hint: When I step through the code, it skips the .Edit line, goes to the
>>error, and will not allow me edit the record.

>>Thanks, Ed

>>P.S. I've put the important code below for your reference.

>>The sub below is called when the form is on a new record.

>>Private Sub CreatePerfID()

>>    Dim PerfID As String    'local variable for a unique PerformerID

>>    On Error GoTo DuplicatePerfID_Err

>>    PerfID = Left$(LastName, 4) & Left$(FirstName, 2)
>>    PerfID = StrConv(PerfID, vbUpperCase)

>>    With Me.Recordset
>>            .Edit
>>            'txtPerfID = PerfID ' txtPerfID is the text field on the

>form -

>>doesn't work
>>            .Fields("tblNewContactInfo.PerfID") = PerfID - this does not
>>work here because of the error. Worked elsewhere though.
>>            '.Fields("tblNewPerformerStatistics.PerfID") = PerfID - I

>tried

>>changing both PK and FK (what the hay, it might have worked :) )
>>            .Update
>>    End With

>>    Exit Sub

>>DuplicatePerfID_Err:
>>    If Err.Number = 3022 Then 'duplicate index or primary key values.
>>        MsgBox "You have a duplicate primary key!" ' I will make the last
>>character increment 1, 2, 3 in this case.
>>        Exit Sub
>>    Else
>>        MsgBox "Some unknown error " & vbCrLf & Err.Number & " " &
>>Err.description
>>        Exit Sub
>>    End If

>>End Sub



Tue, 04 May 2004 13:20:34 GMT  
 Not sure what this error means. (Error 3426)
Excuse my brilliant ingleesh. "I solved the solution...". It was getting
late and I was tired. :-)
Quote:

> Thanks for the help Todd!

> I solved the solution by checking the KB article you suggested and
> doing a little bit of experimenting. I searched for this before, but
> couldn't find it. Did you find this by searching the VB knowledge
> base? What keywords did you search for?

> Oh, in the end, the solution here was embarrassingly simple. Here it is:

>     txtPerfID = PerfID

> Where txtPerfID is a text field and PerfID was a field in a query. No
> need to reference a recordset.

> Thanks again, Ed Beliczynski


>>Q189851:

>>CAUSE
>>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 "action was
>>cancelled by an associated object" 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.

>>RESOLUTION
>>Check the underlying recordset to see if either the BOF or EOF properties
>>are True before allowing an implicit save to occur. An implicit save occurs
>>either when using the data control to navigate off of a record where the
>>information has changed or adding a record to a bound recordset.



>>>I have a form based on a simple query. The query links two tables on one

>>key

>>>field named PerfID which gives a unique 6 character ID of the edited
>>>person's record. When I run my code, I get Error 3426 - This action was
>>>cancelled by an associated object.

>>>I'm not clear on the meaning of the error message. Does anyone have advice
>>>on where I can start debugging this one?

>>>Hint: When I step through the code, it skips the .Edit line, goes to the
>>>error, and will not allow me edit the record.

>>>Thanks, Ed

>>>P.S. I've put the important code below for your reference.

>>>The sub below is called when the form is on a new record.

>>>Private Sub CreatePerfID()

>>>    Dim PerfID As String    'local variable for a unique PerformerID

>>>    On Error GoTo DuplicatePerfID_Err

>>>    PerfID = Left$(LastName, 4) & Left$(FirstName, 2)
>>>    PerfID = StrConv(PerfID, vbUpperCase)

>>>    With Me.Recordset
>>>            .Edit
>>>            'txtPerfID = PerfID ' txtPerfID is the text field on
>>> the

>>form -

>>>doesn't work
>>>            .Fields("tblNewContactInfo.PerfID") = PerfID - this does not
>>>work here because of the error. Worked elsewhere though.
>>>            '.Fields("tblNewPerformerStatistics.PerfID") = PerfID - I

>>tried

>>>changing both PK and FK (what the hay, it might have worked :) )
>>>            .Update
>>>    End With

>>>    Exit Sub

>>>DuplicatePerfID_Err:
>>>    If Err.Number = 3022 Then 'duplicate index or primary key values.
>>>        MsgBox "You have a duplicate primary key!" ' I will make the last
>>>character increment 1, 2, 3 in this case.
>>>        Exit Sub
>>>    Else
>>>        MsgBox "Some unknown error " & vbCrLf & Err.Number & " " &
>>>Err.description
>>>        Exit Sub
>>>    End If

>>>End Sub



Tue, 04 May 2004 22:21:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Error 3426, what does it mean?

2. Database Error No. 3426 (VB 5) / Datenbankfehler 3426 (VB 5)

3. Err # 3426 What does it mean

4. Error 3426

5. Help with Error 3426

6. Run time error 3426 problem

7. Run Time Error 3426

8. error 3426 ???

9. 3426 Error

10. How to get behind error 3426

11. error 3426

12. run-time error 3426

 

 
Powered by phpBB® Forum Software