• (Class)module: Faster? (2000)

    • This topic has 2 replies, 3 voices, and was last updated 23 years ago.
    Author
    Topic
    #370231

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #585169

      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.

    • #585175

      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.

    Viewing 1 reply thread
    Reply To: (Class)module: Faster? (2000)

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

    Your information: