Visual Basic use of Null in if statements

  • Thread starter Thread starter PowerPoint Jedi
  • Start date Start date
P

PowerPoint Jedi

I am trying to run an event that checks the status of a field and if it is
null should do one action and if not null should do another. I can't seem to
get it to work. Any idea here is the code

Private Sub Quality_Approval_AfterUpdate()
If Forms![ERGR]![ME Approval] = Null Then
Forms![ERGR]![Quality Approval] = ""
Else
DoCmd.OpenForm "frmPassWord", acNormal, , "[Name] = '" & Me![Quality
Approval] & "'"
Forms![frmPassWord]![Source] = "Quality"
End If

End Sub

No matter what the value of [ME Approval] it performs the else action

Thanks
 
Also, make sure the value is truly null and not a null string ("") or a space
(" "). These are all treated differently.
 
Thanks everyone for the help.

The isnull solved the first problem I had. The extra information about the
"" and Null was helpful in another set of if statements I was working with.

For now I finished what I needed to do. Been a while since I have done any
programing so this was kind of a crash course
 
Back
Top