locked
Can't add a record. The referenced "record name" is either not set or no longer exists RRS feed

  • Question

  • I have 2 screens... one adds records and the other can add and update records. I created the separate add only screen so I could add a record with most of the fields already filled in. The add only screen has multiple parms... one for each field on the screen.

    I first call the add and edit screen and bring up an existing record. Then via a button execute method I call the add only screen sending it all the fields on the screen except one... i.e. me.application.ShowAddOnlyScreen (parm1, parm2, parm3, Parm4 etc.)

    In the initialize dataworkspace of the add only screen I propagate the fields sent as parms into their respective fields on the add only screen.

    All fields fill in properly and I am presented with a new data screen with all fields pre-filled except the AccountId field which I then select via a MWP. That all works perfectly... however, when I click "Save" I get the error The Referenced "the name of the record" is either not set or no longer exists. I don't understand why I am getting this error when the record I am attempting to save is from a New Data screen?

    I thought that maybe because the original add or edit screen was still open that might be creating a problem (although I couldn't see how) so I put code in the add and edit screen to close the screen before calling the add only screen. No joy... the same error message is displayed when I click Save on the add only screen.

    I'm stumped.  Any ideas?

    Thanks


    • Edited by Jyuma1 Tuesday, October 8, 2013 10:36 AM spelling
    Tuesday, October 8, 2013 10:35 AM

Answers

  • Never mind... 

    I didn't notice that the entity I was trying to create had a relationship to another table and the error was telling me that the field that holds that relationship (I assume the foreign key) was not set. 

    Problem resolved.

    • Marked as answer by Jyuma1 Tuesday, October 8, 2013 12:30 PM
    Tuesday, October 8, 2013 12:30 PM