We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How you code a form to valadate form fields to prevent the creation of a record.

Everwulf
Everwulf asked
on
Medium Priority
236 Views
Last Modified: 2012-05-11
I have a database that I need to prevent the auto-record creation. I have looked online and there seems to be two methods. Method one is using an unbound form which sounds more of a headache than what I am looking for. The other is validating the fields in the form which sounds much easier so I am looking in that direction.

Couple things to mention:

The form (frmCalls) which can be launched from the New Call or Update Call buttons contains a sub-form which will also need to be validated.

I will be adding a cancel button to abort the record but it is not there yet.

Due to the importance of this database all fields on this form and subform need to be validated.

Is there a simple code to do this or will I be writing code for each field.
CallCentre.mdb
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
And unbound forms really aren't that much of a headache.
Create the bound form.
Select all the controls that are bound
Put an empty space in the control source
Move to another property field
Go back to the control source and remove even the empty space
Done, everything is unbound.

Now you need to code some recordset stuff to populate the fields on load and current.
And code some recordset stuff to validate and blow in records on a "Save this input" button click.

A lot of the structure of the code is the same.
It isn't that much work, because there can be a lot of copy and paste.

But...IT"S BULLETPROOF
Users can't create or alter records without jumping through your hoops.
And that makes it worth the effort

Author

Commented:
Capricorn1,

So I would have to put a code similar to that in both the parent form and the sub form for both to be checked...correct?


I also want to have two buttons for them as well, the Complete button for when they are ready to save the record and a Cancel button for when they want to just quit and not make a record. Is there any special code for either that tells it to continue and create or disregarde and not create.

Nick,
Thanks for the head up on unbound forms, Many other sites made it seem like pulling teeth. I might look into it for another project. So thanks.
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
One of the first forms I ever built was based on an un-updateable query...so I had no choices.
I've never looked back.
The inbound form solved that problem...but it was so superior in terms of user experience and preventing user FUBAR that I use them for anything that's fairly involved.

Author

Commented:
Is there any special I would need to do for a cancel button using Validation.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.