473,397 Members | 2,068 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,397 software developers and data experts.

Evaluate Null values

47
HI
I have some problems to evaluate null values,[EmpName] is a string form field that display employee names if an employee is in the table where form is based it works fine for employees that are in the table but when a null val is displayed on this field the If statement doesn't work am I missing something or is there a diferent way to evaluate empty string field values ??

Tks for your help
Raymundo Walle
Expand|Select|Wrap|Line Numbers
  1. If Me.EmpName = "" Then
  2. MsgBox "Usted no esta registrado en este sistema", 16, "Falla de Autentificacion"
  3. DoCmd.Close
  4. Else
  5. DoCmd.OpenForm "Principal", acNormal, , , acFormEdit, acWindowNormal, ""
  6.  
  7. End If
  8. Debug.Print Me.EmpName
  9. End Sub
Jun 26 '11 #1

✓ answered by Mihail

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me.EmpName) Then ...
.

3 2293
Mihail
759 512MB
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me.EmpName) Then ...
.
Jun 26 '11 #2
Stewart Ross
2,545 Expert Mod 2GB
Even simpler is just

Expand|Select|Wrap|Line Numbers
  1. If Nz(Me.EmpName) = "" Then
In this type of usage Nz returns an empty string if faced with a null - which is exactly what you want.

There is an alternative use of Nz which is not required in this case:

Expand|Select|Wrap|Line Numbers
  1. someval = Nz(anothervalue, returnvalue)
The short form listed above is exactly the same in its effect as the following full usage of Nz:

Expand|Select|Wrap|Line Numbers
  1. If Nz(Me.EmpName, "") = "" Then
-Stewart
Jun 26 '11 #3
rwalle
47
Mihail, Stewart:
thanks for your response the form is doing what it's intended to

Thanks

Raymundo Walle
Jun 26 '11 #4

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

Similar topics

1
by: Marcus | last post by:
Hello, quick question about MySQL storing NULL values... Say I have a textbox called $_POST and a variable $var. if(empty($_POST)) $var = NULL; else $var = $_POST; Disregarding...
26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
12
by: D Witherspoon | last post by:
What is the accepted method of creating a data class or business rules object class with properties that will allow the returning of null values? For example... I have a class named CResults with...
8
by: manning_news | last post by:
Using SQL2000. According to Books Online, the avg aggregrate function ignores null values. ((3+3+3+3+Null)/5) predictably returns Null. Is there a function to ignore the Null entry, adjust the...
6
by: Tino Wildenhain | last post by:
Hi, SELECT 'abc'::text || 'def'::text; returns 'abcdef' as we know. SELECT 'abc'::text || ''::text; returns 'abc'
3
by: JOEP | last post by:
What do I need to do to allow an append query to post null values to records in a field of the destination table? Basically I want to allow records with null values to post to the table. The append...
3
by: Rico | last post by:
Hello, I have a foreign key constraint between two tables (Appointments and MissedAppointmentReasons) and I'd like to allow null values in Appointments table for the field containing the...
0
by: gp | last post by:
I am and have been using PDO for about a year now...and have finally gotten around to solving the "DB NULL value" issues I ran into early on... I am looking for suggestions and techniques to...
10
by: Toby Gallier | last post by:
Hello! I have a form that is calculating averages as follows: " =(NZ()+Nz()+Nz())/3 " However I need to now adjust for null values , so for example if value2 is null I would then need to...
10
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following three files. 1. Users.aspx is a webpage that uses the <asp:ObjectDataSourcecontrol to populate a simple <asp:ListBoxcontrol. 2. The UserDetails.cs file creates a Namespace...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.