473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Validation Rule for Not Null value

Hi,

How to set Validation Rule?

Example, my Textbox should not be empty. So, I set validation rule as "Not null". But it shows only at the end of record save.

I must need to show when they leave from textbox itself. Not at the end of the record. And,I need to show my Own message

Can anybody please suggest me?

Thanks in advance.

ngr.
Apr 14 '07 #1
6 31929
Rabbit
12,516 Expert Mod 8TB
Do it using code in the lost focus event of the textbox.
Apr 14 '07 #2
Do it using code in the lost focus event of the textbox.
============

Hi,

I just tried as below in the lost focus.

If Not IsNull(Me!Text1) Then
MsgBox "Eh..! It cannot be Empty."
End If

Is it correct?.

It says when I leave the textbox/combo box empty. But, It also shows the same message even when i fill the textbox. How could the same message comes even i filled the control?

Further, it also allows me to move to the next control. I need to stop when the control is blank in the current control itself. I used the below code.

Docmd.GoToControl (text1)

Is it correct..?

Pls.suggest me.

Thanks in advance.

ngr.
Apr 16 '07 #3
you may try to this

<>0


put that in the validation rule
Apr 16 '07 #4
or set the field property to required = yes...sory about my last post...its applicable for combo box calling number values
Apr 16 '07 #5
or set the field property to required = yes...sory about my last post...its applicable for combo box calling number values
=====

Hi,

Thnx for your info...

But, i m totally confused.(rrrrhhh....)

Anyhow, Please let me know the steps.

1. In the Table design, i hve set "<>0" value for combobox and "Not null" value for textbox. Do I Want to write the same RULE on the control in the form designs?

2. How do i display my own message?. What should i write in combobox/textbox_lostfocus event?. When the error comes,it should not allow to move next text/combo box?

Whatever i had written is not working properly.

To conclude this 2 condition, pls write simply code that should i use..

I becoming MAD since morning.

Thanks in advance.

ngr.
Apr 16 '07 #6
Rabbit
12,516 Expert Mod 8TB
============

Hi,

I just tried as below in the lost focus.

If Not IsNull(Me!Text1) Then
MsgBox "Eh..! It cannot be Empty."
End If

Is it correct?.

It says when I leave the textbox/combo box empty. But, It also shows the same message even when i fill the textbox. How could the same message comes even i filled the control?

Further, it also allows me to move to the next control. I need to stop when the control is blank in the current control itself. I used the below code.

Docmd.GoToControl (text1)

Is it correct..?

Pls.suggest me.

Thanks in advance.

ngr.
The Not shouldn't be there. Not IsNull means if it's not null. You may also want to try IsEmpty instead.

To keep the focus on that control, use the code you posted or use Me.ControlName.SetFocus

Except in your code you need to surround the name of the control with quotes.
Apr 16 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
3
by: Dalan | last post by:
I apparently need a bit of assistance regarding the structure of some validation code on the BeforeUpdate or AfterUpdate event on a form for several fields that need to controlled. I did search the...
2
by: Dalan | last post by:
This ought to be simple enough, but not certain which to use. I have a few fields set to Require data to be entered; however, the message displayed by Access 97 is too generic to be of any real...
2
by: Doslil | last post by:
I am trying to validate the fields in my database.I have already validated the fields to check for not null.Here is what I have written for Numeric and text field. Private Function EENUM() On...
2
by: Danny | last post by:
I created a function to test to see if entered text has a '.' in it, The code seems to work but the validation always fails even when 'true' is returned. i put = myfunction in the validation...
5
by: Don Sealer | last post by:
I've got a validation rule that says something like =xx or xxx or zzzz. Though I may not have described it well it does work fine and that is really not my question. Here's what I'd like to do....
4
by: AMBLY | last post by:
Hi Hope you can help me with this I run Access2000 on XP Form has 3 fields: cboSTATUS - which can be set via Limited value List A B or Complete. Default is set as A. cboTHIS - which can...
1
by: MLH | last post by:
Anyone remember if A97 append query failure would ever report data breaking validation rule when such was not the case. I have an old SQL statement - several years old now. I've encountered a case...
18
by: ChipR | last post by:
I have a text box with a validation rule and validation text. When entering a new record, if I put in invalid text, the validation text is displayed in a message box, but after clicking OK, another...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.