Hello. I tried but couldn't make a sql line work. If you give me a hand, I'd be very very grateful.
I'd like to put a WHERE clause where I confont the date in an unbound textbox with the date in the table. In vba I control the null case of the unbound textbox, but I'm not sure how to control the null value in the sql code.
here is the code "strDataRiferiment" that I later insert in a concatenated SQL code. The rest of the code works, while this line doesn't. The problem are the null date records present in the table COMMESSE.
What I'd like is a WHERE clause that:
- returns records with all null date values and
- returns records with not null values where these dates are < date chosen in the unbound textbox
I tried for example:
Help?
I'd like to put a WHERE clause where I confont the date in an unbound textbox with the date in the table. In vba I control the null case of the unbound textbox, but I'm not sure how to control the null value in the sql code.
here is the code "strDataRiferiment" that I later insert in a concatenated SQL code. The rest of the code works, while this line doesn't. The problem are the null date records present in the table COMMESSE.
What I'd like is a WHERE clause that:
- returns records with all null date values and
- returns records with not null values where these dates are < date chosen in the unbound textbox
Code:
Select Case Nz(Me.InizioDataRif.Value, "Null") 'the unbound textbox
Case "Null"
strDataRiferimento = "AND (([if is not null] COMMESSE.DataChiusura =< #" & Format(Me.FineDataRif, "mm\/dd\/yyyy") & "#) OR (COMMESSE.DataChiusura IS NULL)) "
Case 'etc
'etc..
end select
Code:
"AND ( IFF ((COMMESSE.DataChiusura,0) IS NOT NULL,
(COMMESSE.DataChiusura,0) =< #" & Format(Me.FineDataRif, "mm\/dd\/yyyy") & "#) , (COMMESSE.DataChiusura) IS NULL) )) "