How to execute code when someone saves or enters a new record

joe789

Registered User.
Local time
Today, 00:31
Joined
Mar 22, 2001
Messages
154
Hi Folks,

I have a form which loads when a microsoft access database is opened for some simple data entry. The form has some code which hides or unhides certain needed or un-needed fields depending on the type of record being entered. The type of record is determined by a drop down box field on the form. So if the user select the type of record as 'A', all the fields related to entering a 'B' record are hidden ... and if the user selects the type of record as 'B', then all fields related to entering a 'A' record are hidden. The code is placed in the 'OnChange' portion of the type of record combo box. It works well and I have not had any problems with it while testing.

My question is how would I globally make all 'A' and 'B' fields invisible if the user saves and/or enters a new record until they chose which type of record it is to be entered. There are so many ways that a user can save, enter a new record, or progress thru the form. Is there a place that code can be placed where regardless of how the user saves or enters a new record, it will be activated so that I would be able to use my [fields].visible = false statements when that happens.


Thank you,

Joe
 
I've just done something similar, involving selecting either Permanent or Temporary employees from a combo box.

What I used were two functions. One made all fields, buttons, etc. related to Permanent employees invisible, One did the same for Temporary employees.

Behind the 'After Update' event of each control, I placed a call to whichever function was relevant.

Any use?
 
use the oncurrent event of the form to fire the code based on the value in the drop down box

Peter
 

Users who are viewing this thread

Back
Top Bottom