Centralizing Code for Form Buttons in a Module (1 Viewer)

GAK34nj

New member
Local time
Yesterday, 20:38
Joined
Jul 28, 2020
Messages
5
I have a variety of buttons which I've placed in the header areas of my forms. Depending on the form, some or all of the buttons are placed on the header.

There are the buttons:

  • Save, Add New Record - label: SAVE | ADD
  • Save, Continue Editing - label SAVE | EDIT
  • Save, Close Form - label SAVE | QUIT
  • Quit Form (No Save) - label NO SAVE | QUIT
I know some of you will have natural objection to the idea of this - but I want to explicitly induce these actions on the part of my users. Explaining to them that completing the record advances to the next serves little good, and I wrestled for a LONG time with the issue of how to quit a form without saving it's contents - a bit of hardship there.

Anyway - The code for these operations is repeated on -each- of the forms these buttons are found on. I'd love to place the entire bit in a module, pass a parameter value to the module, and have the module take action. It raises questions though! Can you save a record on a form and/or close the form from a module -outside- the form itself? Moreover, can you exercise those operations, -not- close the form, and then return to it to do things like requeries and other continued work / data entry?

I'm fantasizing about a solution but my pathetic ineptness at scripting makes it very elusive indeed. Any help here would be immensely appreciated.

With thanks,

Gary
 

Isaac

Lifelong Learner
Local time
Yesterday, 17:38
Joined
Mar 14, 2017
Messages
1,972
I know some of you will have natural objection to the idea of this - but I want to explicitly induce these actions on the part of my users
No. On the contrary, I think this is absolutely the right way to go and this is what I do in all my design as well. I provide explicit buttons to do all of these things and get rid of the silly access defaults that cause more harm than good by constantly doing things that nobody expects should be being done and are non-intuitive.
More tomorrow.
 

June7

AWF VIP
Local time
Yesterday, 16:38
Joined
Mar 9, 2014
Messages
3,296
I build buttons and disable form X close, disable application X close, disable File>Exit, disable right click menu, apply custom ribbon. capture and negate Delete key action.

However, coding a centralized module to handle actions from buttons on multiple forms is a challenge. Not sure practical nor worth effort.
 

Micron

AWF VIP
Local time
Yesterday, 20:38
Joined
Oct 20, 2018
Messages
3,467
Can you save a record on a form and/or close the form from a module -outside- the form itself?
Yes.
can you exercise those operations, -not- close the form, and then return to it to do things like requeries and other continued work / data entry?
Yes.
You would have to decide whether it is easier to build this code so that it is not repeated n times per n buttons or if it is simpler to keep it separate. I would start with pencil and paper and detail what you think are the major steps, leaving several blank lines between each. You will find that as you start planning it out, you will need to insert segments that perform unseen tasks. This will also help you determine what parameters that need to be passed to a function (likely this will be a function as it will probably need to return some sort of value for at least one aspect of it). Those parameters might be form name as string or form as object, form OpenArgs, control name or some other property such as .Tag, Boolean values, etc. Your function might take several parameters. Could be a fun exercise and a great opportunity to learn coding skills, but as June7 says, is it worth the investment in time? IMHO, if you're in a non-pressure situation and are being paid a salary while you learn, it's a great opportunity to expand coding skills.
 

arnelgp

error reading drive A:
Local time
Today, 08:38
Joined
May 7, 2009
Messages
10,253
there was no answer there so nobody's effort was wasted.
 

bob fitz

AWF VIP
Local time
Today, 01:38
Joined
May 23, 2011
Messages
4,099
there was no answer there so nobody's effort was wasted.
Not on this occasion. If the OP takes the trouble to read the link then hopefully the OP won't waste anybody's effort in the future :)
 

June7

AWF VIP
Local time
Yesterday, 16:38
Joined
Mar 9, 2014
Messages
3,296
Exactly. If I hadn't seen this thread first I might have put more effort into the other one. Now others who read it will know there is another thread possibly already with responses.
 

arnelgp

error reading drive A:
Local time
Today, 08:38
Joined
May 7, 2009
Messages
10,253
which rule? where? here?
if you truly and purely want to give help, Give All.
not counting it.
otherwise, stop jumping from one forum to another
trying to Help?
 

June7

AWF VIP
Local time
Yesterday, 16:38
Joined
Mar 9, 2014
Messages
3,296
There are no rules/laws for using "please" and "thank you" but I'm sure your momma said you should. That's etiquette. Hence "rules of etiquette" - most of us live by them for social harmony.
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:38
Joined
Sep 21, 2011
Messages
6,662
Plus there is the issue that someone on the other forum will still attempt to help, when you have have already given a solution here.?
 

arnelgp

error reading drive A:
Local time
Today, 08:38
Joined
May 7, 2009
Messages
10,253
There are no rules/laws for using "please" and "thank you" but I'm sure your momma said you should. That's etiquette. Hence "rules of etiquette" - most of us live by them for social harmony.
you're another code Grabber. I remember you!

if you can direct me to This forum anything about Crossposting ill stop participating here.
I have seen lot's of new comer here left because of this branding.

Mr.Gasman, ill post an a2007 version, I need to install a VM first.
 

bob fitz

AWF VIP
Local time
Today, 01:38
Joined
May 23, 2011
Messages
4,099
you're another code Grabber. I remember you!

if you can direct me to This forum anything about Crossposting ill stop participating here.
I have seen lot's of new comer here left because of this branding.
Whatever your opinions are on cross posts I hope the OP reads the link provided and in particular the section which says, “Lest you choose to just flat out ignore my advice, YOU will be the one being ignored. News of chronic cross posters travels quickly, and you may find yourself with no replies at any forum. Remember that the online community is both larger and smaller than you think. Many people transcend boards, and are staunch about protecting their efforts and the efforts of their friends who don't.”
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:38
Joined
Sep 21, 2011
Messages
6,662
you're another code Grabber. I remember you!

if you can direct me to This forum anything about Crossposting ill stop participating here.
I have seen lot's of new comer here left because of this branding.

Mr.Gasman, ill post an a2007 version, I need to install a VM first.
@arnelgp
No need to go to that trouble arnel. I thought you could just save in another format. :(
Thanks all the same.
 

arnelgp

error reading drive A:
Local time
Today, 08:38
Joined
May 7, 2009
Messages
10,253
..protection of efforts..
that's not my goal when I first joined this forum.
to help, and not to gain Recognision.
 

June7

AWF VIP
Local time
Yesterday, 16:38
Joined
Mar 9, 2014
Messages
3,296
The cross post notice isn't just for us who would respond but also for searchers seeking a solution for similar issue. If someone reads the other thread first, even though there is no solution there they have a link to another thread that might.
 

deletedT

Guest
Local time
Today, 01:38
Joined
Feb 2, 2019
Messages
1,220
I'm a member of a lot of forums. Mostly CAD/CAM and engineering ones.
The only forum that reacts against cross posting is Access forums. (AWF and UtterAccess)
In other forums, even links to other sites is not welcomed. Because it may direct the traffic to other sites.
So giving a thank you etiquette that my mama taught me is far different from this cross posting etiquette. Because it's per site etiquette not globally.

So, for me it's more an Access etiquette rather than online etiquette. (Or maybe MS etiquette)
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom