Null String Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help...it's been a very long time since I have done this type of
programming so this question may sound a little silly. I have a form inside
of an access db that allows a user to input an employeeid, a completion date,
and a request number. The use can chose to insert all the information at
once if it is readily available or they can enter only the employeeid and
date, then come back to insert a request number. The code thus far works
kinda like this...checks to see if the employeeid is valid....if so checks to
make sure that there the request number that they are trying to enter has
already been associated with this employee, if not then it needs to determine
if the record has an employeeid = a variable w/in a text box, and a
completion date = a variable w/in a text box and that the requestnumber is
null. Then to update it. As I got through the code I can see that the
recordset is finding the employee id = variable, the date = variable, and the
request number is null, but my if statement.....if rst[request_num] = "" or
if rst![request_num] = NULL then
rst.Edit....blah blah. I hope this makes sense and if anyone can help me
please let me know. Thank you for bearing with me.
 
This is how I check for a Null value or an empty string in one test:

If Len(rst![request_num] & "") = 0 Then
' the field contains either a Null or empty string
Else
' the field contains some string or value
End If
 
"Null" is never equal to anything, even itself. Use the builtin IsNull
function to determine if an object is Null.

If IsNull(rst!requestnumber) Then ...

Larry Linson
Microsoft Access MVP
 
Back
Top