Scott,
I think you're on to something, here. EOF() for locview explains RECNO() returning RECCOUNT() + 1. So, the issue becomes why is the grdList.nRecNo storing 1? Looks like it's not expecting the view to be at EOF()...
I'll send this out to Kevin for final approval, but in the meantime I think it would be cleanest to make the following changes to kCustCtl.vcx:
Change line 80 of cListObjEdit.cmdAdd.Click():
GOTO IIF(This.Parent.CListObj1.grdList.nRecNo <= RECCOUNT(lcAlias), ;
This.Parent.CListObj1.grdList.nRecNo, ;
RECCOUNT(lcAlias)) IN (lcAlias)
Line 34 of cListOneToManyObj.Cancel():
GOTO IIF(This.CgridList1.nRecNo <= RECCOUNT(lcAlias), ;
This.CgridList1.nRecNo, ;
RECCOUNT(lcAlias)) IN (lcAlias)
Line 6 of ListObj.Cancel():
GOTO IIF(This.grdList.nRecNo <= RECCOUNT(), ;
This.grdList.nRecNo, RECCOUNT())
Hope that helps for now,
---J
>Jason,
>
>I looked a little closer per your suggestion. I use a local view, call it locview. The table it pulls from is, let's say sometable. Here's what I see in the debugger when I trap just after the form is init'd:
>
>Recno('locview') = 1
>Reccount('locview') = 0
>clistobjedit.grdlist.nrecno = 1
>EOF('locview') = TRUE
>BOF('locview') = FALSE
>
>Although, both the view and the table, sometable, BOTH have zero records in them! This is very confusing to me, because now the grdlist.nrecno property seems to be one higher than what is actually in the view/table? I'm not sure what to do here. Could it be that I have three (3) clistobj objects on one form?
>
>Thanks!
>
>>Scott,
>>
>>That code looks fine. The framework only stores nRecNo when the add is successful. From what you're describing, I'm wondering if it's possible that the first record isn't really saved. Then, when you cancel the second addition attempt, the framework tries to access the first, and you get that error.
>>
>>Remember, too, issuing BROWSE on a row-buffered view will commit its changes, which may explain why you aren't seeing this when debugging. Always check field values in the debugger instead.
>>
>>I would check to be sure that the first record is really saved, and what the resulting nRecNo value is -- both for the first record, as well as subsequent attempts.
>>
>>Hope that helps,
>>---J