Sunday, December 9, 2018

NAV CAL - Locking and Blocking Notes


  • Problem:
    • Locking and Blocking occurs whenever you use a FIND('-') with a REPEAT
    • It will lock the table while it runs through the repeat loops
  • Solution:
    • Use For .. DO instead
    • Use FindFirst or Findlast instead of Find('-') when dealing with large recordsets where you only need the first record
    • Build the logic in a way that resets the filter on the table for each pass and runs the routine without needing to use the REPEAT functions
      • The slightly slower performance is worth it to eliminate the locking issue
    • This method will allow you to do SQL selects while your code is running on the table, and will also allow other users to complete their tasks without locking up the tables

No comments:

Post a Comment