473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IS NOT NULL in validation

147 New Member
I have a form with a field called ClearanceCode, I want to create a validation rule for it that requires that if another field called DateClosed has a date entered that the data in the ClearanceCode field can not be "Open". Something like:

IFF(IS NOT NULL[DateClosed] <>"Open")

I know I am way off. Any help would be appreciated.

Thanks'
Dan
Dec 4 '07 #1
5 2697
Nathan H
104 New Member
I have a form with a field called ClearanceCode, I want to create a validation rule for it that requires that if another field called DateClosed has a date entered that the data in the ClearanceCode field can not be "Open". Something like:

IFF(IS NOT NULL[DateClosed] <>"Open")

I know I am way off. Any help would be appreciated.

Thanks'
Dan

I have something similar on a dependent field in a form. Perhaps this will work, I put this code in the AfterUpdate event property of the first text box:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_AfterUpdate()
  2. Me![Text2].Requery
  3. If Me![Text1] = Null Or Me![Text1] = 0 Then
  4.     Me![Text2].Visible = False
  5. Else
  6.     Me![Text2].Visible = True
  7. End Sub
  8.  
Dec 4 '07 #2
ADezii
8,834 Recognized Expert Expert
I have a form with a field called ClearanceCode, I want to create a validation rule for it that requires that if another field called DateClosed has a date entered that the data in the ClearanceCode field can not be "Open". Something like:

IFF(IS NOT NULL[DateClosed] <>"Open")

I know I am way off. Any help would be appreciated.

Thanks'
Dan
Here is an example of how you can validate entries in these 2 Fields at a Form Level. Place the code in the BeforeUpdate() Event of the Form.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. Dim Msg As String
  3.  
  4. If Not IsNull(Me![DateClosed]) And Me![ClearanceCode] = "Open" Then
  5.   Msg = "The Clearance Code Field cannot contain the value Open if the "
  6.   Msg = Msg & "Date Closed Field contains a valid Date." & vbCrLf & vbCrLf
  7.   Msg = Msg & "This Record cannot be Saved!"
  8.     MsgBox Msg, vbExclamation, "Field Validation Error"
  9.       Cancel = True     'Cancels the Update to the Record
  10. End Sub
Dec 4 '07 #3
lee123
556 Contributor
are these field both text boxes? need more information on these field for instance:

ClearanceCode :

what do you mean by "open"
because when you say open this could be form or a subform?

lee123
Dec 4 '07 #4
DAHMB
147 New Member
are these field both text boxes? need more information on these field for instance:

ClearanceCode :

what do you mean by "open"
because when you say open this could be form or a subform?

lee123

Open is my term for if the case is open or closed it has notheing to do with the code. and they are text boxes and the DateClosed is formated as a date.

Thanks for any suggestions
Dec 4 '07 #5
DAHMB
147 New Member
Thank you everyone
I ended up using Adazii suggestion which worked perfectly. Thanks again.
Dec 4 '07 #6

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

Similar topics

3
13520
by: Lynn | last post by:
Hi all, I am having problem when did the validation of XML document with Schema. my schema is like the following: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="schema.xsd"...
4
2542
by: Rich | last post by:
I have a access form that is connected to linked sql table via odbc. I have some fields that I dont want to allow nulls when data is entered via the form. I can set the null checking on the SQL...
4
8213
by: Stephen D Cook | last post by:
I have a form linked to a Table. In the form, I have some textboxes, some checkboxes, and a AddRecord command button. I set the validation rule of the txtEmpNo textbox to Is Not Null, I set the...
2
28079
by: krismath | last post by:
I am unable to have the "null" value working for the validation of the text field. The code is able to validate if the sid value is having one,two,three spaces....but not more..it is sloppy...
1
6984
by: RDizzle | last post by:
okay. so all i am doing is changing a registration script that uses $_GET to a script that uses $_POST, but the validation script now returns NULL values for all posted vars. What's the deal? ...
7
63074
by: tomlebold | last post by:
Are the following two validation the same: 1) IsNull(Me.ColumnName) and Me.ColumnName = "" 2) Me.ColumnName """ It would seem to be better to use: Me.ColumnName """
4
2113
by: Eric Layman | last post by:
Hi everyone, Im puzzled by a NULL behaviour in SQL 2000 server. There is a column in the table that does not allow NULL. During data mining, the staff noted that, for that particular column,...
6
31945
by: solargovind | last post by:
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...
12
3043
by: JHNielson | last post by:
I have a simple question, but I can't seem to find the answer. I have this code to count the number of records that pass through a set of processes: It counts how many records go through...
16
16613
by: sreemati | last post by:
Hi everyone, This is the scenario: I have two button - Submit and Reset Submit is used for validation and after validation is passed it passes it to another form to enter into database. ...
0
7072
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
7271
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
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.