Results 1 to 6 of 6
  1. #1
    alpinegroove is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Jan 2011
    Posts
    114

    How to Check If Two Fields are Null?

    I have two currency fields in a form: [Salary1] and [Salary2].
    I would like VBA to take action only if both of them are null.

    I know how to do this for one field:
    If (IsNull(Me.[Salary1]) = False) Then



    But what is the syntax for checking if both fields are null?

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Following your method:

    If (IsNull(Me.[Salary1]) = False) AND (IsNull(Me.[OtherField]) = False) Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    alpinegroove is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Jan 2011
    Posts
    114
    I kept trying it with & and couldn't get that to work.
    What is the difference between & and AND?
    Thank you, again...

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    & is used for concatenation; And is used for logical tests. You want And for this.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    alpinegroove is offline Competent Performer
    Windows XP Access 2002
    Join Date
    Jan 2011
    Posts
    114
    Thank you!

  6. #6
    Stingaway is offline Efficiency Junkie
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    The deep south. Keep going until you hit water basically.
    Posts
    224
    Quote Originally Posted by pbaldy View Post
    & is used for concatenation; And is used for logical tests. You want And for this.
    Well said.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Is Not Null...Multiple fields
    By msk7777 in forum Access
    Replies: 13
    Last Post: 11-17-2011, 02:52 PM
  2. Combine two fields, Null fields involved
    By yes sir in forum Access
    Replies: 9
    Last Post: 10-03-2010, 09:20 AM
  3. Null Check
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-04-2010, 12:59 PM
  4. Replies: 5
    Last Post: 03-20-2010, 08:30 AM
  5. Replies: 5
    Last Post: 02-10-2010, 12:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums