Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 30 Times in 30 Posts

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

    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.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,462
    Thanks
    1
    Thanked 38 Times in 37 Posts

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

    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.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

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

    Regardas,
    Lesoch

  5. #5
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 30 Times in 30 Posts

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

    Lesoch,

    To disable the box, use

    CommandBars.DisableAskAQuestionDropdown = True

    and to toggle its state, use

    CommandBars.DisableAskAQuestionDropdown = Not CommandBars.DisableAskAQuestionDropdown

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,462
    Thanks
    1
    Thanked 38 Times in 37 Posts

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

    >>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!
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

  9. #9
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

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

    Regards,
    Lesoch

  10. #10
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,462
    Thanks
    1
    Thanked 38 Times in 37 Posts

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

    If Microsoft ever fixes the references problem, I will take back all the nasty things I've ever said about them!<g>
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  11. #11
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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?

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 30 Times in 30 Posts

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

    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.

Posting Permissions

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