Autosplitkey problem!

Nav_NavNav_Nav Member Posts: 7
This is the situation: I have a main form with a subformcontrol.
The subformcontrol has the following properties set to YES in the subform:
- AutoSplitKey
- DelayedInsert
- AutoPopulateFields

I can insert several lines in the subform, as long as I stay with one main record. As soon as I change the main record and try to add lines there, the following error pops up: "No. '10000' already exists". I made no changes to the default sorting order and the primary key of the subform table is an integer.
The numbers that are being generated as long as I stay with one main record:
10000
20000
30000

To make things worse, even older custom forms where everything used to work fine with the subform, keep giving the same error message now.

I'm really out of options here ](*,) , could anyone please help?? [-o< [-o<

Comments

  • MBergerMBerger Member Posts: 413
    And what is the key of the table you are using in that form ?
  • Nav_NavNav_Nav Member Posts: 7
    MBerger wrote:
    And what is the key of the table you are using in that form ?
    Table in main form:
    - PK: 'No.', code
    Table in sub form:
    - PK: 'No.', integer
    - FK: '... No.', Code (related to main form table)
  • MBergerMBerger Member Posts: 413
    And is there a link between the form and the subform ? if so, it will try to put a filter on the subform, with the value of the mainform ( as specififed in that link ) and it will try to insert a line with that. If the value that is used for the link is 10000, and there is already a value 10000 in the subtable, i think you'd get that error.

    btw, normally the subtable has the PK of the main table PLUS another field ( the integer ) as a PK. Like with the sales header/sales line combination
  • kinekine Member Posts: 12,562
    It seems you are missing something...

    If the PK of main form is 'No.'(code), then PK for subform must be something like 'No.'(code), 'Line No.' (integer) to have correct lines. If you have PK in sbtable only the No. (it means the line no.), there can be only one entry with line no. 10000 etc. and if you add some other filter, than you are not able to insert the records there... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.