Nulls And Zero Length Strings

G

Guest

Hi,

Reading the help section it states that I can use the "Required" and
"AllowZeroLength" properties to prevent users from leaving fields blank.
Those two properties don't seem to appear for fields with data type "Number".
It appears I can only set the "Required" property to Yes for the Number data
type.

The reason I'm asking is because I have a field that holds a Student ID of
type "Number" and that field absolutely cannot be left blank or empty.

Is there a way ( using VB ) to force a field of type Number to assume the
two properties listed above?

-AKA
 
S

Shane via AccessMonster.com

Hey Spawn,

I'm certainly no where near an expert so someone my tell you different but
one thought I have is to check to see if StudentID is Null or Empty then you
will know which way to go.

Example:

If Trim(Nz(Me.StudentID,"")) = "" Then
'Do what you need to here incase it's Null or Empty
Else
'Do what you need to here if it's not
End If

HTH,
Shane
 
A

Allen Browne

Number type fields have a required property.
Set it to Yes if you do not want to allow Nulls, i.e. if the user must enter
some number.

A zero-length-string is not a number, and so is not appropriate for a Number
type field.
 
D

Douglas J. Steele

Unless you're doing arithmetic on the Student Id, my suggestion would be to
make it a Text field.

Just because there are only digits in the Id doesn't mean it has to be
stored in a numeric field.
 
G

Guest

Gentlemen,

The StudentID field is actually a Foreign Key to the Student table. I
apologize for not saying this in the original post. So, based on the replies
I have recieved thus far, it appears that I need to follow Allen's path of
setting the "Required" property to "Yes".

I really appreciate the feedback from all who answered this post. All the
suggestions posted here can be used in other areas of my database, so thanks
a million to all of you :)

-AKA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top