urjudo
asked on
null or ""
Hi Experts,
I would like to know the difference between null or ""
for example: should BDDate = "" or BDDate = null
date field or numeric field should use "" or should use Null
Text field should use Null not ""
am I correct?
any help would be very appreciated.
Thanks
I would like to know the difference between null or ""
for example: should BDDate = "" or BDDate = null
date field or numeric field should use "" or should use Null
Text field should use Null not ""
am I correct?
any help would be very appreciated.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried to do the coding.
If PDState = "Y" then
PDUser = ""
end if
when I ran the query if PDUser is not null, one of the case shows in the query, but the PDUser is empty, so I changed to
If PDState = "Y" then
PDUser = Null
end if
when I ran the same query, the query ran correctly.
that's why I wonder if I should use Null for datefield and text field or I shohld use "" for datefield and Null for text field.
If PDState = "Y" then
PDUser = ""
end if
when I ran the query if PDUser is not null, one of the case shows in the query, but the PDUser is empty, so I changed to
If PDState = "Y" then
PDUser = Null
end if
when I ran the same query, the query ran correctly.
that's why I wonder if I should use Null for datefield and text field or I shohld use "" for datefield and Null for text field.
I AVOID Empty Length Strings at all costs as Table Field values because visually ... you cannot tell a Null from a ELS.
You can use this test
IF Nz(x,"")="" Then ' whatever
or
IF Nx(x,"") > "" Then ' whatever
You can use this test
IF Nz(x,"")="" Then ' whatever
or
IF Nx(x,"") > "" Then ' whatever
"if I should use Null for datefield and text field or I shohld use "" for datefield and Null for text field."
You should use Null for Both ... then you only have to worry about testing like this .... IsNull (SomeField)
You should use Null for Both ... then you only have to worry about testing like this .... IsNull (SomeField)
ASKER
so I should never use "" in coding or I can use "" for if the field is a number field (like 12345)?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!! I wish I can give you all 500 points each.
The data is unknown.
"" is a Empty Length String that has not been initialized.
Dim X as String
at this point. X="" ... which IS valid data.
X="Duggan"
Now it's initialized