[AccessD] Recording Locking

Darren - Active Billing darren at activebilling.com.au
Sun Jan 14 00:54:21 CST 2024


Hi Ryan

I regularly write things like this:

Would this help?

Throw up a message box with an "Are you Sure" question along with a YES/NO (vbYesNo) option

And if the User chooses YES - then do something 

If they chose NO then do something else

That way if the user starts the process and walks away before answering YES or NO, the worst you have is a message box open (modal and popup) 


——————————————————
Private Sub Command0_Click()


Dim strRecordDescription As String

strRecordDescription = "Just Testing"

        
        If MsgBox("Are you sure you want to remove: " & vbCrLf & vbCrLf _
            & "Record Name:  -   " & strRecordDescription & "?", vbQuestion + vbYesNo, "Confirm Delete") = vbYes Then
              
            Debug.Print "The user Chose YES"
            'the User Chose Yes so run the delete query
            DoCmd.SetWarnings False
            'DoCmd.RunCommand acCmdDeleteRecord
		'or run some update SQL here
		'or call a pre-existing query here
            DoCmd.SetWarnings True
            'anyy other code you might wanna add - refresh or updates elsewhere
        Else
            Debug.Print "The user Chose NO"
            'The User chose no so do things relative to that response
        End If

DoCmd.SetWarnings True

End Sub

----------------------------------------

Darren

----------------------------

> On 11 Jan 2024, at 3:58 am, Ryan W <wrwehler at gmail.com> wrote:
> 
> Well I still want the prompt, I think setwarnings is gonna just blow by the
> delete prompt.
> 
> It seems like the only way is a command button, since the custom prompt in
> the BeforeDelConfirm still locks the rows up.
> 
> On Wed, Jan 10, 2024 at 9:31 AM Rocky Smolin <rockysmolin2 at gmail.com> wrote:
> 
>> Would set warnings=false help? But I think your idea is probably best.
>> 
>> R
>> 
>> On Wed, Jan 10, 2024 at 5:43 AM Ryan W <wrwehler at gmail.com> wrote:
>> 
>>> Hey all,
>>> 
>>> I had an interesting situation I don't think I've encountered before:
>>> 
>>> I had a user come to me the other day and said they couldn't run one of
>> the
>>> calculation command buttons. I ran it and got a query timeout.
>>> 
>>> I checked for blocking SPIDs and found the one blocking this.  I went
>> back
>>> to that workstation and the user had highlighted rows from a datasheet
>> and
>>> pressed the delete key but left the deletion prompt up and walked away.
>>> 
>>> This left a transaction open that was blocking other users from
>>> modifying/inserting/deleting rows in the same tables, even if it was
>>> unrelated data.  I'm guessing the primary key column(s) were locked up in
>>> all of this.  Once I hit OK or Cancel on that dialog prompt, the system
>>> returned to normal.
>>> 
>>> The only 'fix' I can think to come up with would be to make a delete
>> button
>>> that uses a MsgBox and then runs the delete code on the selected rows,
>>> since that would only run AFTER the MsgBox OK button is pressed...  or
>> just
>>> tell my users "don't walk away from confirmation dialogs".
>>> 
>>> Anyone got any words of wisdom on this?
>>> --
>>> AccessD mailing list
>>> AccessD at databaseadvisors.com
>>> https://databaseadvisors.com/mailman/listinfo/accessd
>>> Website: http://www.databaseadvisors.com
>>> 
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> https://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list