DBF CONNECTION dont consider is not null in query

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

DBF CONNECTION dont consider is not null in query

Post by sal21 »

Code: Select all

Option Explicit
Public Sub APRI_CON_DBF()
    
    Dim strCnString As String
    Set CON = New ADODB.Connection
    strCnString = "Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=" & SBASE & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine"
    CON.Open strCnString
    
End Sub
Sub UNO()
    
    If CON Is Nothing Then
        Call APRI_CON_DBF
    End If
    
    Dim STRDBROWS() As Variant, I As Long
    
    Set RS = New ADODB.Recordset
    SQL = "SELECT AB, AC, AD, AEFROM " & NOME_DBF & " WHERE NOT DATATT IS NULL ORDER BY AB DESC"
    RS.Open SQL, CON, adOpenForwardOnly, adLockReadOnly ', adOpenKeyset, adLockPessimistic
    
    'I = RS.RecordCount
    
    RS.MoveFirst
    Erase STRDBROWS()
    STRDBROWS = RS.GetRows()
    RS.Close
    Set RS = Nothing
    
End Sub

the query dont consider the not is null in filed LIDATATT !!!!

NOTE:
The filed DATATT have a Date property

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: DBF CONNECTION dont consider is not null in query

Post by HansV »

Does it work if you use

WHERE DATATT IS NOT NULL
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: DBF CONNECTION dont consider is not null in query

Post by sal21 »

HansV wrote:
03 Nov 2022, 14:52
Does it work if you use

WHERE DATATT IS NOT NULL
ARGGG...

Not consider

WHERE DATATT IS NOT NULL
and
WHERE NOT DATATT IS NULL

!!!!

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: DBF CONNECTION dont consider is not null in query

Post by HansV »

Sorry, no idea.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: DBF CONNECTION dont consider is not null in query

Post by sal21 »

HansV wrote:
03 Nov 2022, 15:09
Sorry, no idea.
:groan:

thanks anyway

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: DBF CONNECTION dont consider is not null in query

Post by StuartR »

I would guess that if DATTAT is NULL then Not DATATT will also be NULL
StuartR