Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7999105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:24:24+00:00 2026-06-04T15:24:24+00:00

I have several buttons coded with VBA behind an Access form. I will have

  • 0

I have several buttons coded with VBA behind an Access form. I will have a number of forms which will have these buttons in their footer (new, next, prev, duplicate etc). These buttons are not standard macros, but are simple enough to have the same code work across all of my forms.

How might I go about coding these buttons (which have the same names across all forms.. kind of template-like) so I don’t have to copy-paste the code in all my forms? Is there a way to write these buttons in a Module and have the form import that module’s text (kind of like most other languages)?

Just curious. Makes the code a lot cleaner/easier, as the beef of the programming is my own but others will be making small edits to the form code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:24:25+00:00Added an answer on June 4, 2026 at 3:24 pm

    The simplest thing to do would be to create a Function for each button’s functionality in a standard code module. Then change the Click property of each button from [Event Procedure] to the name of the function that corresponds with that button (eg, =MyPrevFunction([Form])).

    Note that in order for this to work you must specifically use Function and not Sub. There is no requirement in VBA for a function to return anything, so simply substituting the word Function for Sub is all that is required to make the change.

    screen shot of Property Sheet showing =MyButtonFunction([Form]) in On Click event

    A picture is worth a thousand words.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in which several buttons are added at runtime via a
I have a form which contains several standard controls (textbox's, buttons, etc). I want
I have several radio buttons that are dynamically populated on a form and I
I have a HTML form where I use several buttons. The problem is that
I have a winforms app and the main (and only) form has several buttons.
I have seen several sites where these social share buttons looks perfectly horizontal aligned.
In VBA on Excel, I have a loop over several thousands of cells, which
I have several controls in my windows form, namely a Richtextbox and 10 buttons
In my layout xml file I have several buttons like this which share the
I have a sliding div and several buttons that will trigger the animation at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.