Results 1 to 3 of 3
  1. #1
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111

    Form_BeforeUpdate triggering message when user accidently cllicks outside of row


    The code below actually works well except when the user uses the mouse (instead of the tab) to move from textbox to textbox (it is in datasheet view) and accidentally clicks outside a field (like the field header or on the edge of the field - which seems to happen a lot for one of my users). In this case the message box below pops up before they are actually finished entering the record. Any suggestions as to how I can accomplish the same data validation process without using form_before update? I thought about adding an "Add record" button but didn't like the way it worked (process wise-not coding wise) on my datasheet view (which is how I want my entry form to look).

    I had the fleeting thought of trying to disable the mouse functionality but knew that would not go over well.

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim ctl As Control
    Dim var As String
    
    For Each ctl In Me.Controls
        If ctl.Tag = "required" Then
            var = ctl.ControlTipText
            If ctl = "" Or IsNull(ctl) Then
                MsgBox "You've have not checked all the required steps for this record. Please see the following " + var, 48, "More Info Required!"
                Cancel = True
                ctl.SetFocus
                Exit Sub
            End If
        End If
    Next
    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Not really, once the user clicks off the record, the event is triggered, there isn't another event to do the same thing. You could make the row height bigger or use a continuous form (which can be made to look like a datasheet) so it is harder for the user to click off the record. You can also use visual clues like conditional formatting, and/or use the format property to display a message that something needs to be completed.

    I presume you have set the tab order and key behaviour so users have a natural way for completing a record by just using the tab and enter keys?

  3. #3
    newbieX is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    111
    I tried making the row height bigger and that seems to reduce the problem. And yes, I did have the tab order and key behavior set. Some people are just used to using the mouse to go from one field to the next.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 02-09-2016, 09:03 PM
  2. Nagging Multiuser Access Message for a single user
    By Jerry O in forum Programming
    Replies: 3
    Last Post: 02-18-2015, 10:15 AM
  3. Message Box and User Input
    By MintChipMadness in forum Programming
    Replies: 3
    Last Post: 01-10-2013, 05:18 PM
  4. Send a message for other user
    By smahdih in forum Access
    Replies: 2
    Last Post: 11-18-2011, 01:52 PM
  5. Replies: 2
    Last Post: 09-23-2010, 02:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums