Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    97 - If Null Then.... (97 SR2)

    Hi guys and gals, new to this forum, and maybe not as advanced, so please bare with me. I am also new to writing code; there in lies the real problem.

    I want to set field (Art Work Notes Code) to the letter "N" if the value for another field ( Art Work Notes) is empty or Null. I have successfully written the code to change it if it contains a value as this:

    If Forms![Order Move Image Info]![Art Work Notes] <> " " Then Forms![Order Move Image Info]![Art Work Notes Code] = "I"

    I would think that if I were to write code:

    If Forms![Order Move Image Info]![Art Work Notes] = "" Then Forms![Order Move Image Info]![Art Work Notes Code] = "N"

    Would work, but it doesn't.

    Any thoughts or suggestions would be appreciated. However, keep in mind that I am new at writing code. I would guess I need to be in the "Newbies" catagory.

    Thanks!
    KST

    ------------------------------------------
    K. Scott Tidmore
    Carrollton, Georgia
    ------------------------------------------

  2. #2
    New Lounger
    Join Date
    May 2002
    Location
    Gen, Gen, Switzerland
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 97 - If Null Then.... (97 SR2)

    An empty string and a null string are not the same, so you have to test for both. Actually if you can have both value depends of the field's setting (AllowZeroLength and Required, see Access's help for explanation)

    So try the following code:
    If (Forms![Order Move Image Info]![Art Work Notes] = "") Or IsNull(Forms![Order Move Image Info]![Art Work Notes]) Then
    Forms![Order Move Image Info]![Art Work Notes Code] = "N"
    Else
    Forms![Order Move Image Info]![Art Work Notes Code] = "I"
    End

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: 97 - If Null Then.... (97 SR2)

    Thanks JP, worked great. I knew the code had to be there, I just didn't know enough to make it work.

    KST

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •