Forum Discussion

Betabiz's avatar
Betabiz
Experienced User
2 years ago

Migration Error - Foreign key constraint name = FK_NZGSTReturnOptions_OutputTaxAccount

Hi

 

Am trying to upgrade a V19 AccountRight Standard file to 2023.2.  Below is my log.

 

The linking for the GST codes is all correct, there are no linked adjustment codes in the Prepare GST return.  I dont know where else to look.

 

Can anyone shed any light on this for me please?

 

Unsuccessful: Migration failure

Company File Name : C:\Users\User\AppData\Local\MYOB\Temp\company file name.MYO
Start Time : 04/04/2023 16:27:26 PM
End Time : 04/04/2023 4:30:19 PM

Migration Warnings:
- Warning1 : Inserting Constraints: A foreign key value cannot be inserted because a corresponding primary key value does not exist. [ Foreign key constraint name = FK_NZGSTReturnOptions_OutputTaxAccount ]

Migration errors:
Source : UpgradeUtility
Method : Upgrade
Error : (UpgradeException):
Extra info : System.Data.SqlServerCe.SqlCeException (0x80004005): A foreign key value cannot be inserted because a corresponding primary key value does not exist. [ Foreign key constraint name = FK_NZGSTReturnOptions_OutputTaxAccount ]
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at AR.Common.Database.SQLTask.ExecuteSQL(String sqlScript, SqlCeCommand command)
at AR.Common.Database.SQLTask.Execute()
at AR.Common.Database.SqlCeFileWrapper.ExecuteScripts(IEnumerable`1 scripts)
at MYOB.Huxley.UpgradeUtility.DbCeManager.InsertFkConstraints()
at MYOB.Huxley.UpgradeUtility.UpgradeStepsToV1.DbInsertFKConstraintsUpgradeStep.ProcessStep()
at MYOB.Huxley.UpgradeUtility.UpgradeStep.Process()
at MYOB.Huxley.UpgradeUtility.UpgradeUtility.Upgrade()

Unsuccessful upgrade!

  • Hi Betabiz 

     

    In your v19 file, go to the Accounts Command Centre and select Prepare GST Return. Check the value for GST Output Tax Adjustment - the error seems to indicate the account selected here cannot be found in the accounts list. Try clearing any value here. If it is already clear, it may only appear to be and may actually hold a corrupt value, so try setting it to a valid existing account. Close and re-open this screen to ensure the entry sticks - if not there is likely a file corruption issue. If the account is now a valid account, try the upgrade again. Let us know how you get on.

     

    Regards

    Gavin

  • Hi Betabiz 

     

    In your v19 file, go to the Accounts Command Centre and select Prepare GST Return. Check the value for GST Output Tax Adjustment - the error seems to indicate the account selected here cannot be found in the accounts list. Try clearing any value here. If it is already clear, it may only appear to be and may actually hold a corrupt value, so try setting it to a valid existing account. Close and re-open this screen to ensure the entry sticks - if not there is likely a file corruption issue. If the account is now a valid account, try the upgrade again. Let us know how you get on.

     

    Regards

    Gavin

    • Betabiz's avatar
      Betabiz
      Experienced User

      Thanks Gavin

       

      I had removed the value for the GST outputs adj box - so I added a new GST GL code, added that to the outputs adjustment in the GST return, optimised the file then tried the upgrade again ... and it worked!!!

       

      Appreciate your help - thank you