Greetings and Happy Thanksgiving!
I have a TableUpdate question...
My users are getting a
"Waiting for lock..." message
I've finally been able to reproduce it.
It occurs when
the 1st user goes into the QC Form and from there goes into the ReportText Form (1st time only) and keeps the ReportText form open
the 2nd user goes into the OrderEntry Form and from there goes into the ReportText Form, clicks the "Completed" button and exits the form. Clicking the "Completed" button causes the Form Release to try and send a record to the QC table
When the TableUpdate for the QC table is executed we get the
"Waiting for lock..." message
The lock is released when the 1st user exits the ReportText Form.
The lock problem only occurs the 1st time the 1st user goes into the ReportText Form (via the QC Form)
If the 1st user gets out of the ReportText Form before the 2nd user then there is no lock problem, even if the 1st user gets back into the ReportText Form.
This happens EACH 1st time the 1st user gets into the ReportText Form via the QC Form
In other words if the 1st user closes the QC Form and goes back in, it will happen again the 1st time he goes into the ReportText Form, this time....subsequent entries into the ReportText Form during this QC Form session do not have this problem.
The
TableUpdate command line I'm using is
SELECT wbobsQC
lTableUpdateRetVal = TableUpdate(2,.T., "wbobsQC", "problemrecs")
The WBOBSQC is opened for Optimistic Table Buffering
The WBOBSQC will typically only have one record that needs updating...although it's possible to have a few...
I tried switching this to:
SELECT WBOBSQC
lTableUpdateRetVal = TableUpdate(1,.T., "wbobsQC", "problemrecs")
I've also tried switching this to:
SELECT wbobsQC
BEGIN TRANSACTION
lSuccess = .T.
lTableUpdateRetVal = .T.
SELECT wbobsQC
FOR nCount = 1 TO ALEN(ThisForm.aSendToQC)
LOCATE FOR UPPER(ALLTRIM(wbobsQC.Report_Num)) == UPPER(ALLTRIM(ThisForm.aSendToQC[nCount]))
lTableUpdateRetVal = TableUpdate(0,.T., "wbobsQC", "problemrecs")
IF NOT lTableUpdateRetVal
I've tried this last one with optimistic table buffering
and
I've tried this last one with optimistic row buffering
but I still get the Lock message if the other user is in the ReportText Form via the QC Form and it is the first time since entering the QC Form that the user has gone into the ReportText Form...
I still don't understand why it only happens the first time and not every time.
How would you approach this?