Making a Function for the Switch Board

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ericks
    New Member
    • Jul 2007
    • 74

    Making a Function for the Switch Board

    Trying again:

    I use the standard Access Switchboard with 8 buttons. In the mouseover event of each button I have the label text change by following code:
    Code:
    Private Sub Option1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error Resume Next
    Call SetBold(Me, "optionlabel1")
    End Sub
    That is 8 times this code which doesn't seem very efficient to me. Can I substitute this with a Function instead and that includes all 8 buttons? What would the Module look like?
    Last edited by NeoPa; Mar 15 '08, 12:26 AM. Reason: Please use [CODE] tags
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    No, you'd have to call the function from each MouseMove event just as you are now. And to be perfectly frank, you're already over engineering this thing!

    Why would you want to use

    Call SetBold(Me, "optionlabe l1")

    every time the mouse moves over the button to call a function to accomplish something that can be done with this single line

    YourButtonName. FontWeight = 700

    It makes no sense to replace a single line of code with a function call when the function is going to use the same single line of code to accomplish the task.

    Linq ;0)>

    Comment

    • Ericks
      New Member
      • Jul 2007
      • 74

      #3
      Makes sense. And indeed it works. Beauty and efficiency lay in simplicity.

      Thanks Linq.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Glad we could help!

        Linq ;0)>

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32656

          #5
          As a full member now, you should know that we expect your code to be posted in [CODE] tags (See How to Ask a Question).
          This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
          Please use the tags in future.

          ADMIN.

          PS. I just found that you've posted the same question twice as well. This is also mentioned in the guidelines so I'd be grateful if you avoided this in future.

          Just to let you know, I will delete the other thread that now seems to be abandonned.

          Comment

          Working...