Results 1 to 4 of 4

Thread: Error Tooltip

  1. #1
    Join Date
    Jan 2012
    Posts
    23

    Unanswered: Error Tooltip

    Hello everyone,

    Is it possible to make error handling tooltip. For example, I have 2 textboxes - whenever one or both is empty show tooltip saying "Please enter data." Only solution I found so far is mouseover tooltips. Can anyone help?

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    A ToolTip requires the cursor to be over the Control, and really isn't appropriate for validation purposes. You wouldn't want a warning popping up continuously, until the user filled in a Control, would you?

    Standard approach for this type of validation is to use the Form_BeforeUpdate event:
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    
     If Nz(Me.Control1,"") = "" Then
       MsgBox "Control1 Must Not Be Left Blank!"
       Cancel = True
       Control1.SetFocus
       Exit Sub
     End If
     
    If Nz(Me.Control2, "") = "" Then
       MsgBox "Control2 Must Not Be Left Blank!"
       Cancel = True
       Control2.SetFocus
       Exit Sub
     End If
    
    End Sub

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jan 2012
    Posts
    23
    I need some kind of notification next to the control, I guess changing border color of the control could work...

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    How about this:
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    
     If Nz(Me.Control1,"") = "" Then
       
       MsgBox "Control1 Must Not Be Left Blank!"
       Cancel = True
       Control1.SetFocus
       Control1.BorderColor = vbRed
       Control1.BorderWidth = 4
       Exit Sub
     
    Else
    
        Control1.BorderColor = vbBlack
        Control1.BorderWidth = 0
     
     End If
     
    If Nz(Me.Control2, "") = "" Then
       MsgBox "Control2 Must Not Be Left Blank!"
       Cancel = True
       Control2.SetFocus
       Control2.BorderColor = vbRed
       Control2.BorderWidth = 4
       Exit Sub
    
    Else
    
       Control2.BorderColor = vbBlack
       Control2.BorderWidth = 0
    
     End If
    
    End Sub

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •