Expression to hide some/display some data in the same field for Re

K

KJMachado

The query for my Access 2003 Report produces the correct number of vehicle
records, with mileage logs for the month of May (186).

4 of the vehicles became Inactive in May and will not appear on the June
report.
3 of the vehicles became Inactive on 05/07/2009; 1 became Inactive on
05/21/2009.

The 4 Inactive vehicles are replaced by new Active vehicles in May.
3 of the vehicles became Active on 05/07/2009; 1 became Active on 05/21/2009.

The field for the Inactive date is [Veh_IDate] (InactiveDate
The field for the Active date is [Veh_OSDate] (OnSiteDate)

The report needs to show the 178 Active vehicles
And
The 4 Vehicles being marked as Inactive
And
The 4 Vehicles replacing the Inactive vehicles

Other Active Vehicle records MAY have (REPL GXX-XXXXG) but I want to display
in the report ONLY the data in the [Veh_Rsn] that relates to those 8 records
identified above.

[Veh_Rsn] has 3 possible answers:
(1) TERM (indicates Vehicle is no longer in service; is replaced by another
vehicle), i.e., G41-0000G is TERM; (Once vehicle is TERM it does not appear
on future Active reports)
(2) REPL (indicates new Active vehicle REPLacing the TERM vehicle),
i.e., G62-1111G REPL G41-0000G
(3) Field is blank (Vehicle is active; not a TERM or a REPL vehicle)

So….The report needs to show this:

[Name] [License] [RSN] [Veh_IDATE] [Other fields]
Name AA G41-0000G (1) TERM 05/07/2009 Mileage Data
Name AA G62-1111G (2) REPL G41-0000G Mileage Data

I do not want to see:
Name BB G64-4444G (2) REPL G63-3333G (w/o TERM) Mileage Data

But I do want to see:
Name BB G64-4444G (2) (REPL data not visible) Mileage Data
Name CC G65-5555G (3) (field is blank) Mileage Data

How do I write the expression(s) that will produce the above desired results?
Expr1: =IIf[Veh_IDate]=#05/07/2009# Or [Veh_IDate]=#05/21/2009# Or
[Veh_OSDate]=#05/07/2009# Or [Veh_OSDate]=#05/21/2009#, [Veh_Rsn],???
(Parentheses are deliberately removed)

I hope this makes sense!!
Thank you for your help.
 
K

KARL DEWEY

Try this --
Format([Veh_IDate], "yyyymm") = Format(DateAdd("m"-1,Date()),"yyyymm") OR
Format([Veh_OSDate], "yyyymm") = Format(DateAdd("m"-1,Date()),"yyyymm")
 

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