1

So I'm not really sure what is going on here but in my database I have a table that has 1000 records and 36 of them have [workername] empty. I was trying to run this SQL to select the unassigned, empty [workername] records to assign but nothing populates when I put the code in query design and view mode. I genuinely have no idea why this is not working.

strSQL = "SELECT IntakeID, 
                 caseid, 
                 [Program], 
                 [language] 
          FROM Intake 
          WHERE workername Is Null"
     Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
1
  • 1
    Check whether the field contains an empty string: WHERE Len(workername) = 0 Commented Jun 3, 2015 at 1:37

2 Answers 2

2

Try this code..Here first it will replace null value to '' using Nz and if not null it will trim the value to make sure there is no space and check is it equal to '' means empty..hope it will help

"SELECT IntakeID, 
caseid, 
[Program], 
[language] 
FROM
Intake WHERE  LTRIM(RTRIM(Nz(workername, ''))) = ''"
Sign up to request clarification or add additional context in comments.

1 Comment

EVERYONE should literally up vote this!!! I have looked EVERYWHERE for this issue and this was the only one that worked!
0

That query looks valid, so I would question whether the column is actually null.

You could try the following to find out for sure

SELECT 
    IntakeID, 
    caseid, 
    [Program], 
    [language] ,
    ISNULL(workername)
FROM Intake 
  ORDER BY ISNULL(workername) ASC

2 Comments

For some odd reason an Expr1:IsNull([workername]) but workername is literally in the drop down as an option and the code worked for the 900+ other records so it's very odd.
Don't you just love Access :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.