• OK in Offcie 2000 & Office XP but not OK in Office (A2K)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » OK in Offcie 2000 & Office XP but not OK in Office (A2K)

    • This topic has 11 replies, 3 voices, and was last updated 22 years ago.
    Author
    Topic
    #385501

    My Access 2000 application has several command buttons in the main form, two of which are, say, cmdA and cmdB. Clicking each of these two commands will open a new different form. For both commands, the On Mouse Move property referred to a global function which essentially changes the colour of other command text.

    On Mouse Move =gMouseMove(“frmInfo”,[cmdA])
    On Mouse Move =gMouseMove(“frmInfo”,[cmdB])

    The application runs well on all the machines under Win9x to WinXP, and MS Office 2000 all editions as well as MS Office XP (version 10.0.2627.1) Recently one of the users upgraded his Office XP to version Office XP SP1 (10.0.3409.0) under WinXP Home edition. This time when the user clicked on cmdA, it worked as expected. However when cmdB is clicked, the following error message appeared:

    “The expression On Mouse Move you entered in the event setting produced the following error : Can’t find project or library.”

    When I tried the application on my own Office XP SP1 (10.0.3409.0) under Win98, no such error occurred. Can someone tell enlighten me why?

    A second question, how do we make the “Type a question for help” dropdown list on the upper right hand corner disappear in Office XP?

    ——————————————————————————————-
    Function gMouseMove(frm, CtlName As Control)

    Dim cntl As Control, fm As Form

    Set fm = Forms(frm)
    On Error Resume Next
    ‘If the command button is not already highlighted (in blue),
    ‘ the current fore color is saved in the tag property of the
    ‘ button and the colour is set to blue
    If CtlName.ControlType = acCommandButton And CtlName.Tag = “” Then
    CtlName.Tag = CtlName.ForeColor ‘Save original forecolor
    CtlName.ForeColor = vbMagenta
    End If

    ‘ Then any other command buttons on the form are checked and
    ‘ if they are highlighted they are switched off.
    For Each cntl In fm.Controls
    If cntl.ControlType = acCommandButton And _
    cntl.Name CtlName.Name And cntl.Tag “” Then
    cntl.ForeColor = cntl.Tag
    cntl.Tag = “”
    End If
    Next

    On Error GoTo 0
    Set fm = Nothing

    End Function

    Viewing 1 reply thread
    Author
    Replies
    • #665215

      1. Not sure about this, but try compiling the project in the Visual Basic Editor. If you get an error message about unknown types, select Tools/References… If there are MISSING references, note them down, then uncheck them. Try compiling again. You may have to set some references anew.

      2. Right click any toolbar and select Customize… Then right click the “Type a question for help” box and remove the tick from the check box.

      • #665366

        Hans, can I use VBA to programmatically make the “Type a question for help” box disappear?

        Regardas,
        Lesoch

        • #665374

          Lesoch,

          To disable the box, use

          CommandBars.DisableAskAQuestionDropdown = True

          and to toggle its state, use

          CommandBars.DisableAskAQuestionDropdown = Not CommandBars.DisableAskAQuestionDropdown

          • #665576

            Thanks, Hans, it works. But my next problem is : How would I incorporate
            CommandBars.DisableAskAQuestionDropdown = True
            into my Accesss 2000 codes? I don’t want to keep two versions of the codes just to disable the help dropdown list in Access XP!

            I can detect the presence of A2K or Access XP and have a boolean varible AccessXPDectected. These are my codes:

            If AccessXPDetected then
            CommandBars.DisableAskAQuestionDropdown = True
            end if

            But CommandBars.DisableAskAQuestionDropdown = True is always flagged as error since DisableAskAQuestionDropdown property isn’t avialble in A2K’s CommandBars. Is there a way to get around this?

            Regards,
            Lesoch.

            • #665840

              After checking out the resources in the Internet, I managed to come out with these codes which could be compiled and run under A2K without error and managed to disable the AskAQuestionDropdown in Access XP:

              Sub CheckAskAQuestionDropdown()

              Dim obj As Object

              Set obj = Application

              On Error Resume Next
              obj.CommandBars.DisableAskAQuestionDropdown = True

              End Sub

              How and why
              obj.CommandBars.DisableAskAQuestionDropdown = True
              wasn’t flagged an error when compiled under A2K I wasn’t really clear though.

              But as happened before, my “clever” codes would turned out flawed.

              Hans, do you foresee any caveat in the codes above?

            • #665842

              Lesoch,

              I think this should work OK.

              By declaring obj as an Object, you are using late binding – the actual type is not determined when you write the code, but when it is assigned a value in runtime, by the instruction Set obj = Application. This prevents VBA from trying to compile the code using obj. Now, referring to an invalid method only raises a normal error, which is intercepted by On Error Resume Next.

              The only downside is that you lose IntelliSense – the Visual Basic Editor won’t show you the methods and properties of obj, since it doesn’t know what they could be.

    • #665217

      This sounds like a references problem to me. On the machine having problems, hit Ctl-G to get to debug, then from main menu bar select Tools | References. Are any of the checked references flagged as “Missing”? If so, remember which ones they are, remove the checkmarks, then close the references box. Then reopen the references list, find those libraries and recheck them. This should clear-up the problem.

      • #665368

        I will check the reference after this. Thanks. Just puzzled that why no error was falgged for clicking button A but error for clicking button B, while the two On Mouse Move action property refer to the same global function.

        Regards,
        Lesoch.

        • #665400

          >>Just puzzled that why no error was falgged for clicking button A but error for clicking button B, while the two On Mouse Move action property refer to the same global function.<<

          I don't really know. However, missing references cause all sorts of flakey problems, even if they have seemingly nothing to do with the process that is causing the error!

          • #665577

            You are right, Mark, it was the reference problem. Thanks for your help.

            Regards,
            Lesoch

            • #665634

              If Microsoft ever fixes the references problem, I will take back all the nasty things I’ve ever said about them!

    Viewing 1 reply thread
    Reply To: OK in Offcie 2000 & Office XP but not OK in Office (A2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: