Returning Nulls from Date/Time field

Hi Experts

I have a query that returns null dates (even if i order them desc and specify <>"" ) It's in VB6 and excel 2003 - a date time field

Sql = "Select * from CLIENT_CONTROL where [PC_ClientID] = " & Val(CopyClientNr) _
        & " and [PC_ReminderDate] not  '' order by [PC_ReminderDate] desc "
If rs.recordset.nomatch = false then
         debug.print RS.recordset("PC_Client ID") & " ," & RS.Recordset("PC_ReminderDate")
End If

on this data
PC_PatID      PC_PracID      PC_DrID      PC_ReminderDate      
31425            2                        
I get : 31425 ,

I expected not to get nulls. Can anyone explain this?

Many Thanks
peterdarazsAsked:
Who is Participating?
 
tbsgadiCommented:
Hi Peter,

Try using the isnull function

Gary
0
 
peterdarazsAuthor Commented:
Thanks
I have tried:  not isnull [PC_ReminderDate] , [PC_ReminderDate] <> "" , [PC_ReminderDate]  not = "" 

all without success
0
 
bmatumburaCommented:

Sql = "Select * from CLIENT_CONTROL where [PC_ClientID] = " & Val(CopyClientNr) _
        & " and [PC_ReminderDate] IS NOT NULL order by [PC_ReminderDate] desc "

Open in new window

0
 
peterdarazsAuthor Commented:
Thanks , i used these concepts, but ultimately had to switch to using a recordset instead of ?datacomponent
ie :
Set dsCTRLRecord = CURDB.OpenRecordset(Sql, dbOpenDynaset)
instead of :
PatCTRLdata.recordsource = sql

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.