Is there a way to make a control tip show up via VBA?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    Is there a way to make a control tip show up via VBA?

    I would like to be able to make a control tip show up when Me.Recordset.No Match is true. I have the code that does the testing already, but I haven't been able to find online how to makes it visible. This is purely an aesthetic thing so it is no big deal if it isn't possible. I've just seen it done on other programs and thought I would try to duplicate it.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32638

    #2
    This is managed by the mouse Seth. I very much doubt it could work at all if there were a way to set it explicitly via code.

    Comment

    • Seth Schrock
      Recognized Expert Specialist
      • Dec 2010
      • 2965

      #3
      This might be way to complex, but what about calling the MouseMove event in my code? I could change the text back and forth between "" and "Incorrect Loan Number" so that when called by the function it would read "Incorrect Loan Number" and when triggered by the mouse it would be "". I would have to have the function set it to "Incorrect Loan Number", show it, and then at the end of the code set it back to "". Is this the idea of a crazy person or is it worth a try? I haven't ever played with the MouseMove event so I'm not sure what all it does and I thought I would run it by you before I dive into it.

      Comment

      • Seth Schrock
        Recognized Expert Specialist
        • Dec 2010
        • 2965

        #4
        It just suddenly came to me. I can just put a label that has my message and make it visible or not in my If/Then statement and make it a whole bunch easier.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Seth,
          Normally I use a text box as you've mentioned.... or better yet I set the focus back to the control with the invalid data and set the outline to Red from the normal color.

          The tooltip text can be changed in real time by VBA and is something I have done upon occation; however, as Neopa points out, this only "pops" open during a mouse hover.

          I have also used a modal popup form with a close command tripped by the timer event (and an OK button for those that read faster :) ) that warns of things. I like this in that I can set the timer to 0 which forces the user to click ok or the event will close the form in 5 or so seconds. I have done this a few different ways :).
          Last edited by zmbd; Dec 14 '12, 10:21 PM. Reason: [Z{removed the link}]

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32638

            #6
            As I'm thoroughly inebriated ATM I will assume that Z's comment makes sense and answers your question Seth. Actually, I think I understand well enough to appreciate Z's comment actually makes sense. Otherwise, I feel safe to rely on him anyway.

            Comment

            • Seth Schrock
              Recognized Expert Specialist
              • Dec 2010
              • 2965

              #7
              I would rather stay on the small side and keep with the label/textbox and not use the popup form. In this case I like the label better because it doesn't allow the user to click in it. I know that if you set Enable = false, it keeps you from being able to click in it, but then you loose the ability to control the looks of the control. I really wish that you could. I'm not sure why the looks are locked down when Enable is set to false on textboxes.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32638

                #8
                Originally posted by Seth
                Seth:
                I'm not sure why the looks are locked down when Enable is set to false on textboxes.
                It's so that operators have visual clues that the control is disabled. If you want it to look the same but simply be locked, then set .Locked = True instead.

                Comment

                • Seth Schrock
                  Recognized Expert Specialist
                  • Dec 2010
                  • 2965

                  #9
                  I could do that but that still allows you to click in it. Oh well, at least I have options.

                  Comment

                  • zmbd
                    Recognized Expert Moderator Expert
                    • Mar 2012
                    • 5501

                    #10
                    Set the on_click event to set the focus to someother control on the form :)

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32638

                      #11
                      Originally posted by Seth
                      Seth:
                      I could do that but that still allows you to click in it.
                      I was responding to your specific question (hence the quote), rather than making any suggestion for current usage.

                      As Z says, you could force it somewhere else, but that gets messy when trying to handle it taking control from causes other than a simple click. It's very difficult (and I've tried) to leave it without being even more confusing and 'wrong' than the problem you're trying to fix.

                      Comment

                      • zmbd
                        Recognized Expert Moderator Expert
                        • Mar 2012
                        • 5501

                        #12
                        NeoPa,
                        Respectfully, a single control properly formatted with a re-direct shouldn't cause too much confusion for the average user. Most will assume that the control isn't click-able.

                        The other option... and I know people don't like this....
                        Use a label control.
                        me.lblUserFeedB ack_AccountNumb er.caption = strMSG
                        You can set this to some generic message or set the visible property to false until needed. I actually use this control on the popup form and pass the message as an augment; however, I was trying to stay within the "normal" usage of things so I didn't suggest it at first.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32638

                          #13
                          Originally posted by Z
                          Z:
                          NeoPa,
                          Respectfully, a single control properly formatted with a re-direct shouldn't cause too much confusion for the average user. Most will assume that the control isn't click-able.
                          One of the most common, and useful, facilities in a form that uses keyboard control is the ability to Tab forwards and backwards through the controls. Users are unlikely to get confused by such a setup, but they are certainly going to be unimpressed if such an important feature is set aside for something relatively trivial like this.

                          I suspect the Label option is still the best suggestion.

                          Comment

                          • TheSmileyCoder
                            Recognized Expert Moderator Top Contributor
                            • Dec 2009
                            • 2322

                            #14
                            Just a quick remark: If a textbox is BOTH disabled AND locked, you can format it any way you want. If a textbox is ONLY disabled, access will force some degree of formatting upon it.

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32638

                              #15
                              Well I'll be! I never suspected that. It's true of course.

                              Comment

                              Working...