Results 1 to 4 of 4
  1. #1
    sra2786 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Oct 2017
    Location
    Cincinnati, OH
    Posts
    37

    IsEmpty not working

    I cannot figure out why IsEmpty is not working. Can someone explain to me why blTest returns True instead of False


    Sub TestEmpty()


    Dim strTest As String
    Dim blTest As Boolean
    strTest = Empty
    blTest = Not (IsEmpty(strTest))


    End Sub

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,608
    A quick google search finds this:

    https://support.office.com/en-us/art...6-A69A42E55E50

    where you will note that isempty is only meaningful for Variants. If you change your little test to Dim strTest as Variant, you get what you expect.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    2,971
    I seem to remember that Empty refers to a Variant DataType...try changing

    Dim strTest As String

    to

    Dim strTest As Variant

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,426
    For a string, you can use
    Code:
    If len(strTest & vbnullstring) > 0 then
        blTest = true
    else
        blTest = false
    End If

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

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2017, 10:07 AM
  2. Working query stops working after importing
    By Abacus1234 in forum Import/Export Data
    Replies: 3
    Last Post: 10-25-2015, 09:12 PM
  3. Replies: 13
    Last Post: 01-22-2015, 05:27 PM
  4. Replies: 1
    Last Post: 12-27-2014, 12:38 PM
  5. Replies: 3
    Last Post: 01-29-2013, 04:34 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 - Senior Forums