I have a form that provides information to a query utilising Like statements, as displayed below
SELECT tblArchive.DateTo, tblArchive.IndividualsName, tblArchive.BoxNo, tblArchive.Reference, tblArchive.TenantorDescription, tblArchive.ToBeDestroyed, tblArchive.DateDestroyed, tblArchive.DateFrom
FROM tblArchive
WHERE (((tblArchive.IndividualsName)="Acquisitions") AND ((tblArchive.BoxNo) Like "*" & [Forms]![frmarchivesearch]![txtinvboxno] & "*") AND ((tblArchive.Reference) Like "*" & [Forms]![frmarchivesearch]![txtinvref] & "*") AND ((tblArchive.TenantorDescription) Like "*" & [Forms]![frmarchivesearch]![txtinvdes] & "*") AND ((tblArchive.DateFrom) Like "*" & [Forms]![frmarchivesearch]![txtinvdatefrom] & "*"))
ORDER BY tblArchive.IndividualsName, tblArchive.BoxNo;
The problem I have is that the query works great as long as there is not a null value in the datefrom field. I have a field that contains individual's names. Only one of these names results in a value being placed in the date from field.
What options do I have? I was condering a zero value date (00/00/0000) and then just hiding that value through code and formatting. Not sure that MS Access will allow me to do that.
Anybody got any ideas. I have tried a second line in the query, basically an OR statment revolving around blah blah datefrom is null, but then that screws up the search set and gives the wrong results.
Anybody got any ideas?
SELECT tblArchive.DateTo, tblArchive.IndividualsName, tblArchive.BoxNo, tblArchive.Reference, tblArchive.TenantorDescription, tblArchive.ToBeDestroyed, tblArchive.DateDestroyed, tblArchive.DateFrom
FROM tblArchive
WHERE (((tblArchive.IndividualsName)="Acquisitions") AND ((tblArchive.BoxNo) Like "*" & [Forms]![frmarchivesearch]![txtinvboxno] & "*") AND ((tblArchive.Reference) Like "*" & [Forms]![frmarchivesearch]![txtinvref] & "*") AND ((tblArchive.TenantorDescription) Like "*" & [Forms]![frmarchivesearch]![txtinvdes] & "*") AND ((tblArchive.DateFrom) Like "*" & [Forms]![frmarchivesearch]![txtinvdatefrom] & "*"))
ORDER BY tblArchive.IndividualsName, tblArchive.BoxNo;
The problem I have is that the query works great as long as there is not a null value in the datefrom field. I have a field that contains individual's names. Only one of these names results in a value being placed in the date from field.
What options do I have? I was condering a zero value date (00/00/0000) and then just hiding that value through code and formatting. Not sure that MS Access will allow me to do that.
Anybody got any ideas. I have tried a second line in the query, basically an OR statment revolving around blah blah datefrom is null, but then that screws up the search set and gives the wrong results.
Anybody got any ideas?