Select by alternative date if one is null

C

CW

I have a query that selects shipments by their arrival dates (field is
"ArrvlDate") and then displays a number of fields.
Where the arrival date has not been entered for one reason or another, I
need it to use the departure date instead (DepDate").
I have tried various permutations using IsNull in the SQL but no good so
far... your suggestions, please!
Thanks
CW
 
S

Stefan Hoffmann

hi,
I have a query that selects shipments by their arrival dates (field is
"ArrvlDate") and then displays a number of fields.
Where the arrival date has not been entered for one reason or another, I
need it to use the departure date instead (DepDate").
I have tried various permutations using IsNull in the SQL but no good so
far... your suggestions, please!
Use

Nz([ArrvlDate], [DepDate])

in your query.


mfG
--> stefan <--
 
C

CW

Thanks Stefan that's nice and easy
CW

Stefan Hoffmann said:
hi,
I have a query that selects shipments by their arrival dates (field is
"ArrvlDate") and then displays a number of fields.
Where the arrival date has not been entered for one reason or another, I
need it to use the departure date instead (DepDate").
I have tried various permutations using IsNull in the SQL but no good so
far... your suggestions, please!
Use

Nz([ArrvlDate], [DepDate])

in your query.


mfG
--> stefan <--
 
J

John Spencer

And if you want to use IIF then the expression would be

IIF(ArrvlDate is Null,DepDate,ArrvlDate)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Thanks Stefan that's nice and easy
CW

Stefan Hoffmann said:
hi,
I have a query that selects shipments by their arrival dates (field is
"ArrvlDate") and then displays a number of fields.
Where the arrival date has not been entered for one reason or another, I
need it to use the departure date instead (DepDate").
I have tried various permutations using IsNull in the SQL but no good so
far... your suggestions, please!
Use

Nz([ArrvlDate], [DepDate])

in your query.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top