Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Location
    Netherlands
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    (Class)module: Faster? (2000)

    To my information: VBA-codes written in a form's module (= a class module?) is slower than code written in a separate (what's the name of that one?) module, at least in loading of the form.

    If that is so, I want to write every VBA-code in my applications in separate modules.

    But how can I do that efficiently? Building a form, copying code to a new module, renaming all Me! references to Form!fForm1! ? That's not what I want: It takes a LOT of time!
    I'm wondering, can't Access do this for me? The most elegant solution would be that all code connected to buttons, listboxes etc. that I make is automatically put in that seperate type module.

    Any ideas?

    Or.... is my information wrong that seperate modules are slower than form-modules?!

    rettnuc.

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

    Re: (Class)module: Faster? (2000)

    I don't know of any automatic way of doing this. Perhaps somebody knows of an add-in to accomplish it.

    One tip: you can replace occurrences of Me by CodeContextObject by Find&Replace (make sure you have "whole word" checked, otherwise you might get undesired effects). That way, you don't have to refer to the literal name of the form or report.

    I don't think that code in a standard module is especially faster than code in the class module of a form or report. The reason I put some code in a standard module is to make it reusable.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: (Class)module: Faster? (2000)

    I suspect you've been reading about light-weight forms. I've never seen a noticeable difference between forms with a class module and forms without, but that's purely subjective on my part. The code itself isn't faster, but putting *shared* code in a separate container means less code overall in the database. That does affect the performance of the application favorably.

    If you are new to VBA coding and/or to Access programming, stick with putting the code behind the form. You'll save yourself some confusion.
    Charlotte

Posting Permissions

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