Control Tip Text does not pop up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    Control Tip Text does not pop up

    Friends,

    In my DB, I use the following code to set the Caption and ControlTipText properties on a series of command buttons. I must do this, because depending on the type of work we are doing, the captions and tips may change.

    Code:
    Private Sub SetLabels()
    On Error GoTo EH:
        Dim strSource
        Dim dbLabels As Database
        Dim rstLabels As Recordset
        Set dbLabels = CurrentDb()
        strSQL = "SELECT * FROM tblDiscrepancyTypes ORDER BY DiscKey;"
        Set rstLabels = dbLabels.OpenRecordset(strSQL, dbOpenDynaset)
        If Not rstLabels.EOF Then
            rstLabels.MoveFirst
            Do While Not rstLabels.EOF
                Me("cmdDiscrepancy" & rstLabels("DiscKey")).Caption = rstLabels("DiscDesc")
                Me("cmdDiscrepancy" & rstLabels("DiscKey")).ControlTipText = rstLabels("TipText")
                rstLabels.MoveNext
            Loop
            rstLabels.Close
            dbLabels.Close
        End If
        Exit Sub
    EH:
        MsgBox "Error Setting Labels.  Please contact your Database Administrator.", vbOKOnly, "Error!"
        Exit Sub
    End Sub
    Here is the problem: Whenever I hover my mouse over these command buttons, the control tip text never pops up. I do have other commend buttons which are not updated, and their control tips pop up with no problem.

    The There are no errors in the code, and when the form's command buttons have been populated, from the Immediate Window, when I query the control tip text of a command button, I get this:

    Code:
    ?Forms.frmPRFReview.cmdDiscrepancy45.ControlTipText
    produces the desired result:

    Code:
    Click here if there are any other errors or discrepancies found on the PRF
    I have compared the properties for both sets of buttons, and all is identical except the buttons above call a function on the OnClick event, whereas the standard buttons simply execute a standard VBA sub.

    There must be something I am overlooking! Any ideas?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    me.repaint
    Fixed a similur issue for me in V97 and I continue to issue this anytime I change a caption or other non-textbox.

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3662

      #3
      Z,

      Thanks, but no luck so far...... I'll have to play some more with it later....

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        sigh.
        Usually works.
        Lines 12 and 13 look strange... would you confirm that the labels are changing from line 12
        Also do a debug.print _resolvedcontro lname___.contro ltiptext after line 13 where "_resolvedcontr olname___" is the actual name of one of the controls to make sure that the controltiptext has actually changed and is well formed. Sometimes malformed strings won't error... instead they're ignored.

        I just did this in one of the test databases and without repaint the changes took and the tip would show so I suspect it has to be something with how the text is being entered into the control tip property.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Just noticed you printed in the immediate window... sorry.
          I know it seems redunant; however, please do it in the runtime too... wouldn't hurt as a trouble shoot do the debug print after each command execution in the loop. I'm suspecting that you're overwriting the text at somepoint and you may not find it in the stepthru mode.

          Comment

          • twinnyfo
            Recognized Expert Moderator Specialist
            • Nov 2011
            • 3662

            #6
            Z,

            I've been playing with this form for several days, and still with no success....

            Re: Post #4, Lines 12 and 13 ARE executing properly. Just to make sure, I deleted all the Caption and ControlTipText entires. Even entered a space, then deleted the space for each control. The form opened fine and populated the captions for the controls with no problem.

            Re: Post #4 and #5, I added a line of code to Debug.Print each Caption and ControlTipText by name, with no issues.

            My ONLY thought on this might be that there is some type of issue with the data in the table from which the code retrieves the ControlTipText data. But, this would make no sense at all, since both fields are identical (except for max characters). Both fields were simply typed in.

            Very mind-boggling! Any other thoughts or ideas?

            Comment

            • zmbd
              Recognized Expert Moderator Expert
              • Mar 2012
              • 5501

              #7
              For giggles:
              Do the ole make a new db and import.

              IF that doesn't work, then can you post the resolved strings?

              Comment

              • twinnyfo
                Recognized Expert Moderator Specialist
                • Nov 2011
                • 3662

                #8
                Z,

                The resolved strings you are looking for are:

                Code:
                cmdDiscrepancy1.ControlTipText
                ...
                cmdDiscrepancy45.ControlTipText
                I'll work the DB Redo, which is quite the headache because of the Custom view I must rebuilt for my nav pane (unless you know a way to import that?).....

                Comment

                • zmbd
                  Recognized Expert Moderator Expert
                  • Mar 2012
                  • 5501

                  #9
                  I've tried everything I can think of to break the contoltiptext.
                  I've tried buffer-over-runs
                  I've tried special charactors
                  You name it.
                  I think we're going to have to see some of the data.
                  From what I've read, any typable charactor upto 255 in length can go into the property.

                  Comment

                  • twinnyfo
                    Recognized Expert Moderator Specialist
                    • Nov 2011
                    • 3662

                    #10
                    OK, Z,

                    The Access Gremlins win again! Completely new DB, import all, still no worky! Old DB, Copy all old controls, Paste to new controls.... Control tips work on new controls. Delete old controls, rename new controls. All is wonderful again in Accessland...

                    This was not a "solution" but just simply a way to make it work.

                    Why, Microsoft? Why???

                    Comment

                    • zmbd
                      Recognized Expert Moderator Expert
                      • Mar 2012
                      • 5501

                      #11
                      Agreed... Very frustrating.

                      Comment

                      Working...