Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorry for a dumb question...

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
how to check if a password is NULL or blank ?
my table has

userid pwd
abc <NULL>
qpr

can anyone please help ?
its in sql server
Thanks
 
after reading your table, put the password into a variable (ie : pwd) and then type :
Code:
if isnull(pwd) or pwd=&quot;&quot; then
...
Water is not bad as soon as it stays out human body ;-)
 
It all depends if you are checking for NULL or blank and where you are trying to do the check?

in VB:
Check for null : Isnull(rs.field(&quot;password&quot;))
Check for blank: len(rs.field(&quot;password&quot;)) = 0

in SQL
Check for null: where Password = null
Check for blank: where Password = &quot;&quot;

Hope this helps

Chris Dukes
 
to test for null use &quot;WHERE pwd IS NULL&quot; and for blank use &quot;WHERE pwd = ''&quot; Gary Parker
Systems Support Analyst
 
but how can i check it if i have a login form in vB.
txtpwd.
is this right ?
if isnull(txtpwd)= isnull(rs(&quot;pwd&quot;) then
-----
do i need to write 2 if's for null and blank ??

thanks once again

 
I take it you are trying to match the typed apssword against the password held in your sql db ?

try

if isnull(rs!pwd) then 'first test for nuul db entry
if len(txtpwd.text) = 0 then
pass
else
fail
end if
else
if trim(rs!pwd) = trim(txtpwd.text) 'test for all others
pass
else
fail
end if
end if

Gary Parker
Systems Support Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top