Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why Can't It Read The Empty String?!

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
I'm creating reports off of a pre-existing database (I didn't create the database). I need to generate a report, and part of it will have this functionality:

If there is no data entered in for two fields, or if there is data entered for two fields, then display. Otherwise, don't. Possible combos:

CombinedDate1 CombinedDate2
5/5/2006 10/10/2006 Show this!
<nothing> <nothing> Show this!
5/5/2006 <nothing> Don't show this!

Now, the CombinedDate values are created from two seperate fields: one with the date, teh other with the time. I'm attempting to use the following in my SQL:
Code:
AND
 (
([date1]+[time1]<>"" AND [date2]+[time2]<>"") 
OR
([date1]+[time1]=null AND [date2]+[time2]=null)
)

The problem is that I don't get any records back where both fields are empty and have no value! I've also tried this:

Code:
AND
 (
([date1]+[time1]<>"" AND [date2]+[time2]<>"") 
OR
([date1]+[time1]="" AND [date2]+[time2]="")
)

with no luck either.

The date1/2 and time1/2 are all date/time fields in the Access database. Am I missing something here?! If I have nothing and add it to nothing and compare the string value (="") that should be enough...or at the least, it should equal null (=null)...but neither are working?!

Help!

DL
 
Perhaps this ?
AND IsNull([date1]+[time1])=IsNull([date2]+[time2])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top