SQL to select unpopulated date

In my Access 2000 app I need to build a query with a compound condition.  The first two conditions are numeric conditions but the last condition is that I want to pull any record that does not have its date field populated.
Here is what I have so far to satidfy my first two conditions.  What would I need where I have ??????? for the third condition?  The date feild that I want to query is named 'EndStatusDate' and I want the ones that have not been populated.
'
selectString = "Select EndStatusDate From " & wkTable
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and [EndStatusDate] = " & ??????????
'
selectString = selectString & whereCond
LVL 1
mlcktmguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jerryb30Commented:
isnull([endStatusDate]
0
jerryb30Commented:
forgot )
isnull([endStatusDate])
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlcktmguyAuthor Commented:
Thanks for your response.  It seems correct but when I run the following:
'
wkTable = " tblDealHistory"
'
selectString = "Select *  From " & wkTable
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and IsNull([EndStatusDate]) "
'
selectString = selectString & whereCond
'
Dim rsOldHist As ADODB.Recordset
Set rsOldHist = New ADODB.Recordset
rsOldHist.Open selectString, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

processing stops on the last statment (rsOldHist.Open...) and I get an error

'No value given for one or more required parameters.'
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Mike EghtebasDatabase and Application DeveloperCommented:
With null/empty fields in a SQL with WHERE statement, use field names not *.

Like:

     'EndStatusDate may have null/empty values--v
selectString = "Select DealD, OldStatus, nz(EndStatusDate) As StDate From " & wkTable
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and IsNull([EndStatusDate]) "
'
selectString = selectString & whereCond

Mike
0
Mike EghtebasDatabase and Application DeveloperCommented:
Alternates:

selectString = "Select DealD, OldStatus, nz(EndStatusDate,#1/1/111#) As StDate From " & wkTable
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and nz(EndStatusDate,#1/1/111#)=#1/1/1111#"
'
selectString = selectString & whereCond

or maybe just (maybe):

selectString = "Select DealD, OldStatus, nz(EndStatusDate,#1/1/111#) As StDate From " & wkTable
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and StDate = #1/1/1111#"
'
selectString = selectString & whereCond

Mike
0
mlcktmguyAuthor Commented:
Once again thanks for responding.  One at a time I cut and pasted all three of your suggestions into the module.  I get exactly the same error as before.

This is the table definition of the table that I am querying.  Do you see anything else that might be wrong?

         RecordID                              Long Integer                             4
         DealID                                   Long Integer                             4
         OldStatus                              Long Integer                             4
         NewStatus                            Long Integer                             4
         StartStatusDate                     Date/Time                                8
         EndStatusDate                       Date/Time                                8
         Comments                              Memo                                     -
         ActualDate                             Date/Time                                8
         UserID                                     Text                                    20
0
Rey Obrero (Capricorn1)Commented:
try

selectString = "Select *  From ["& wkTable &"]
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and IsNull([EndStatusDate]) "
0
Rey Obrero (Capricorn1)Commented:
is wkTable a variable?

selectString = "Select *  From ["& wkTable &"]
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and IsNull([EndStatusDate]) "

selectString= selectString & whereCond

if not

selectString = "Select *  From  wkTable"
whereCond = " Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and IsNull([EndStatusDate]) "

selectString= selectString & whereCond
0
Mike EghtebasDatabase and Application DeveloperCommented:
I missed the brackets around the table name. If still needed, try:

selectString = "Select DealD, OldStatus, nz(EndStatusDate,#1/1/111#) As StDate From [" & wkTable
whereCond = "] Where [DealD] = " & gDealID
whereCond = whereCond & " and [OldStatus] = " & gPriorStatus
whereCond = whereCond & " and nz(EndStatusDate,#1/1/111#)=#1/1/1111#"
'
selectString = selectString & whereCond
0
mlcktmguyAuthor Commented:
I am embarrased.  jerryb30 supplied a response that was correct.  I kept getting the error because I had used the data name "DealD" instead of "DealID".  By rights I have to give the point to the first correct answer but I appreciate the answers supplied by the other responders.  They gave me some creative ways of handling date queries.  How do I resolve this?  I am going to triple the points and give the original 125 to all responders.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.