Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
.MoveNext() ComException is Unhandeled
The record cannot be deleted or changed because table 'frmfrocc' includes related records bla bla.. am not trying to delete just printing in the middle of printing this exception occurs..
Posted
Comments
Simon_Whale 4-Jan-12 12:28pm    
need more information about it to help! what is this from? Can I assume that its a recordset that you are trying to convert?
Sergey Alexandrovich Kryukov 4-Jan-12 12:28pm    
OK, no problem: just fix it, blah, blah... :-)
Are you getting the hint?
--SA
Tony Radu 4-Jan-12 13:05pm    
yes it's recordset

This sounds like you're actually using ADO with VB.Net. If this is really the case I suggest that you adapt to the ADO.NET since you've started to convert the application to .NET. More information: ADO.NET Overview[^]
 
Share this answer
 
I agree with Mika. Give ADO.NET a try. It is by far a breath of fresh air compared to ADO.

Take a look at this sample application. I feel like there is less hoops to jump through to get what I want done. ADO.NET Sample Application[^]

Also, I have found this resource a big help. Connection Strings[^]
 
Share this answer
 
Comments
Tony Radu 6-Jan-12 2:22am    
is there any way without converting to ADO.Net to check MoveNext(), the following is the
Public Sub WriteOccs(ByRef rstOccsToPrint As ADODB.Recordset, ByRef rstAllOccs As ADODB.Recordset, ByRef rstWageRecordset As ADODB.Recordset, ByRef lblL As System.Windows.Forms.Label, ByRef pbrP As AxComctlLib.AxProgressBar, ByRef cFrmCd As String, ByRef rstIndx As ADODB.Recordset, ByRef rstAlt As ADODB.Recordset)

Dim cAddress As String
Dim nTestCounter, nRecCounter As Short
Dim cCurrentMajor, cCurrentDivision As String
Dim nPointsCounter As Double
Dim cLastPageAddress, cHoldAddress As String
Dim lHaveWeStarted As Boolean
Dim cMajOccFlag As String
Dim cBadMajors As String
Dim cFullDefinition As String
Dim nAltLength As Short
Dim cPrintArea, cLastCol, cLastAddress As String
Dim nLocMax, nLocMin As Short
Dim lPageBreakOK As Boolean
Dim lJustDidDivision As Boolean

nTestCounter = 0
cCurrentMajor = ""
cCurrentDivision = ""
lHaveWeStarted = False
nPageBreakCounter = 0
cPageBreakList = ""
cDivisionPageBreakList = ""
nDivisionPageBreakCounter = 0
With rstOccsToPrint
If .RecordCount > 0 Then

nRecCounter = .RecordCount
Call SetUpProgressBar(pbrP, nLocMax, nLocMin, nRecCounter, lblL, "Writing occupations to form....")

' get the bad major list
'If Right(cFrmCd, 1) <> "0" And Right(cFrmCd, 1) <> "u" Then Call MajorCount(rstOccsToPrint, cBadMajors)

' loop through all the occs
.MoveFirst()
'UPGRADE_WARNING: Couldn't resolve default property of object apExcel.ActiveCell. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
apExcel.ActiveCell.Offset(1, 0).Activate()
nPointsCounter = nSkippedRowHeight
cMajOccFlag = ""
Do Until .EOF

'If !Occ_code = "21-1014" Then Stop
'check for division

'UPGRADE_WARNING: Couldn't resolve default property of object apExcel.ActiveCell. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
cLastPageAddress = apExcel.ActiveCell.Address

If .Fields("division").Value <> cCurrentDivision Then
If lHaveWeStarted Then
If Right(cFrmCd, 1) = "0" Then nPointsCounter = nPointsHigh + 1
'If CheckForPage(cLastPageAddress, apExcel.ActiveCell.Address, nPointsCounter, Right(cFrmCd, 1)) _
'' Then nPointsCounter = 0
Else
lHaveWeStarted = True
End If
Call WriteDivisionHeader(.Fields("division").Value, rstAllOccs)
cCurrentDivision = .Fields("division").Value
lJustDidDivision = True
nPointsCounter = nPointsCounter + nDivisionRowHeight
Else
lJustDidDivision = False
End If

' check for major
' If !Major <> cCurrentMajor Then
' If InStr(cBadMajors, !Major) = 0 Then
' Call WriteMajorHeader(!Major, rstAllOccs, lJustDidDivision)
' nPointsCounter = nPointsCounter + nMajorRowHeight
' End If
' cMajOccFlag = "M"
' cCurrentMajor = !Major
' End If

' now let's build the act
Clark Kent123 6-Jan-12 8:30am    
I have looked at this code, but I am still not sure where do you want to check for MoveNext().

For more information about what MoveNext() is I suggest reading upon it. http://msdn.microsoft.com/en-us/library/ee275535%28v=BTS.10%29.aspx

do while recordset.EOF = False
recordset.MoveNext()
loop

Try something like that. Hard to comment when you posted a block of code which you don't point to me where you think your having the problem.

As a debugging tip that I have learned log everything in the problem. More information is helpful in finding out where your problem lies. console.writeline(insertobjectToInspectHere.tostring())

I hope this helps. Don't give up! :)
Tony Radu 6-Jan-12 16:58pm    
Dataset solved it and much faster....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900