UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Centralizing Code For Form Buttons In One Module, Access 2016    
 
   
GAK34nj
post Jul 31 2020, 10:36 PM
Post#1



Posts: 19
Joined: 29-May 20



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
Go to the top of the page
 
June7
post Jul 31 2020, 11:49 PM
Post#2



Posts: 1,612
Joined: 25-January 16
From: The Great Land


Cross post https://www.access-programmers.co.UK/forums...-module.313091/

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
 
gasman
post Aug 1 2020, 01:45 AM
Post#3



Posts: 7
Joined: 19-October 18



Not only crossposted, but has a viable solution there.?
Go to the top of the page
 
GroverParkGeorge
post Aug 1 2020, 08:31 AM
Post#4


UA Admin
Posts: 37,630
Joined: 20-June 02
From: Newcastle, WA


It's also a topic discussed extensively here at UA recently.

In that discussion, I showed you how to replace references to Me. in your individual Private Subs with a reference to calling forms in a Public Sub, and I urged you to work on some potential solutions to other requirements based on that start.

Here, the same principles apply again.

In order to gain confidence and experience, it's helpful to just try things out. You can probably master the technique fairly quickly, but do give it a try.

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    6th August 2020 - 05:28 AM