HELP: I can't verify text column is empty
-
I am using VB 2008 & MS Access database I have a table WebRateList with 2 columns ResFrom and ResTo defined as DateTime, another column WebID defined as Text (allow Null) When I search:
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "#"
Then it showed "It is in this range!" But if I scan the same row with column WebID must be emptied, it didn't get in (infact the WebID is empty)
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = NULL"
da = New OleDbDataAdapter(strSQL, dbConn)
dt = New DataTable
da.Fill(dt)If (dt.Rows.Count() > 0) Then
MsgBox("It is in this range!")
End IfEven I defined the following the result is the same
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = '' "
Anyone can help? :doh:
-
I am using VB 2008 & MS Access database I have a table WebRateList with 2 columns ResFrom and ResTo defined as DateTime, another column WebID defined as Text (allow Null) When I search:
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "#"
Then it showed "It is in this range!" But if I scan the same row with column WebID must be emptied, it didn't get in (infact the WebID is empty)
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = NULL"
da = New OleDbDataAdapter(strSQL, dbConn)
dt = New DataTable
da.Fill(dt)If (dt.Rows.Count() > 0) Then
MsgBox("It is in this range!")
End IfEven I defined the following the result is the same
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = '' "
Anyone can help? :doh:
You can't use = NULL, you must use IS NULL.
-
You can't use = NULL, you must use IS NULL.
It worked! Thanks for a very quick help :) :) :)