Mandatory Field

benwo

Registered User.
Local time
Today, 10:19
Joined
Nov 29, 2005
Messages
39
Hi

I have a form where data is entered and outcomes are entered. Any ideas how i can make the outcome field mandatory before someone moves on to the next record?

Thanks

Ben
 
Can you simply make it a required field in the table designer?
 
i've tried that but it still lets me move on to the next field!
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

Ken's suggestion will prevent the user from moving to another record if the required field is null.

You need to use the forms and/or another controls "BeforeUpdate" event to verify if another field is empty [Null]. Search around for there are plenty of examples on how to test for Null and empty strings.

Code:
If IsNull(TextBox1) or TextBox1 = "" Then
     Msgbox "You can not leave the X field empty!"
     TextBox1.setfocus
End If
Use the forms BeforeUpdate event for all data validation!

Check these links out for some working examples that will assist your project.

A Better Mouse Trap?

Enable/Disable The Control Box X Button
 
Last edited:
i've tried that but it still lets me move on to the next field!
You'll need a lot of coding if you attempt to control control to control movement through a form. Don't worry about it. Define the field as required, and put most of your field edits in the form's BeforeUpdate event where you can cancel the record save if necessary.
 

Users who are viewing this thread

Back
Top Bottom