What Event Should I use??

S

scadav

Does anyone know what type of event I should use to accomplish the
following:

-I have a database that allows me to add an employee profile to the
system.
-A user hits a button that says "Add New User"
-Once they hit the "Add New User" button everything on the form is
disabled with the exception of the "Save New Profile" button or
"Cancel New Profile" button.
-Assume the user hits "Save New Profile", I have programmed
validations that it must go through (i.e. First Name, Last Name,
Address, City, State, etc). These fields must be filled out in order
to save the profile.
-Once he hits save the user can now navigate anywhere they want in the
rest of the database.

However….the user can now go in and clear out the fields that were
required when they were adding a new profile.

What event should I use to force Access to look at the validations
that I have setup (when saving a new profile) and prevent a user from
changing records if they deleted some of the information setup in the
original creation of the profile?

Thanks,
 
A

Arvin Meyer [MVP]

I would just lock the form once it was saved, at the end of the save
procedure, and in the OnCurrent event of existing records.

Me.AllowEdits = False

For new records, reverse the in the On Current event.

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Does anyone know what type of event I should use to accomplish the
following:

-I have a database that allows me to add an employee profile to the
system.
-A user hits a button that says "Add New User"
-Once they hit the "Add New User" button everything on the form is
disabled with the exception of the "Save New Profile" button or
"Cancel New Profile" button.
-Assume the user hits "Save New Profile", I have programmed
validations that it must go through (i.e. First Name, Last Name,
Address, City, State, etc). These fields must be filled out in order
to save the profile.
-Once he hits save the user can now navigate anywhere they want in the
rest of the database.

However….the user can now go in and clear out the fields that were
required when they were adding a new profile.

What event should I use to force Access to look at the validations
that I have setup (when saving a new profile) and prevent a user from
changing records if they deleted some of the information setup in the
original creation of the profile?

Thanks,
 
S

scadav

But I do want to allow them to edit items and allow them to change
other "non-required" fields on the form. Me.AllowEdits = False will
prevent this, correct?
 
A

Arvin Meyer [MVP]

scadav said:
But I do want to allow them to edit items and allow them to change
other "non-required" fields on the form. Me.AllowEdits = False will
prevent this, correct?

Correct, then you'll have to individually lock the controls you don't want
them to edit. You can use the TAG property, and some code which I have on my
website:

http://www.datastrat.com/Code/LockIt.txt

Remember to use the AfterUpdate and the Current events to ensure the form
stays that way, checking in the Current event for the NewRecord property of
the form.
 
J

John Spencer

It sounds as if you are saying the fields are required.

So, the first step I would look at would be to set that property in the
design of the fields in the table. Also, set the Allow Zero Length
property to NO.

That way the user cannot delete any information in the field (they can
change it to something else, but they can't delete it).

After that you would need to set up validation in entry forms for finer
control. See Arvin Meyer's responses to your post.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top