OR Expression on a Form

  • Thread starter Thread starter Scott B
  • Start date Start date
S

Scott B

Greetings,

I have the following IIf statement that works fine. I would like to add an
OR clause to make it not display the date if it is later than today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the table
sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
=IIf(IsNull([subfrmStays].Form!StayStart) Or [subfrmStays].Form!StayStart >
Date(),"None",[subfrmStays].Form!StayStart)
 
Dear Ken,

Thanks for the quick reply and your help. I tried your language and the OR
does not seem to work. The "None" and the dates still work but it does not
filter out the future date correctly. For the record that has a future date
it displays "None". Any thoughts? By the way, does it matter that the date
is on a subform from a different query? I am only displaying this on the
main form to save constantly clicking back and forth to see when the guest
stayed last for tax purposes and to make sure I have data entered on the
subform. If I enter data on the form I will always enter a stay start date.

Best regards,
Scott

Ken Snell said:
=IIf(IsNull([subfrmStays].Form!StayStart) Or [subfrmStays].Form!StayStart
Date(),"None",[subfrmStays].Form!StayStart)
--

Ken Snell
<MS ACCESS MVP>

Scott B said:
Greetings,

I have the following IIf statement that works fine. I would like to add
an OR clause to make it not display the date if it is later than today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the table
sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
If what I posted isn't working, it is likely that is because I guessed at
which "control" contains a "future" date and used that. So most likely my
expression isn't using the correct data.

You'll need to tell us more specifically what the controls hold, and what
you want to do (in words) within the expression.


--

Ken Snell
<MS ACCESS MVP>


Scott B said:
Dear Ken,

Thanks for the quick reply and your help. I tried your language and the
OR does not seem to work. The "None" and the dates still work but it does
not filter out the future date correctly. For the record that has a
future date it displays "None". Any thoughts? By the way, does it matter
that the date is on a subform from a different query? I am only
displaying this on the main form to save constantly clicking back and
forth to see when the guest stayed last for tax purposes and to make sure
I have data entered on the subform. If I enter data on the form I will
always enter a stay start date.

Best regards,
Scott

Ken Snell said:
=IIf(IsNull([subfrmStays].Form!StayStart) Or [subfrmStays].Form!StayStart
Date(),"None",[subfrmStays].Form!StayStart)
--

Ken Snell
<MS ACCESS MVP>

Scott B said:
Greetings,

I have the following IIf statement that works fine. I would like to add
an OR clause to make it not display the date if it is later than today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the table
sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
Ken,

If I understand what you asked, then the field that holds that data that is
being displayed on the main form is from the subform. The subform reflects
data from a query that sorts data from a guest stay table. The field is
called "staystart". It holds the date that a guest arrives at our B&B. It
is stored in the guest stay table. The data from that field is enterd on
the subform and displayed through the IIf statement
=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)
on the main form. The "staystart" field is a date/time field. Does this
help?

Scott


Ken Snell said:
If what I posted isn't working, it is likely that is because I guessed at
which "control" contains a "future" date and used that. So most likely my
expression isn't using the correct data.

You'll need to tell us more specifically what the controls hold, and what
you want to do (in words) within the expression.


--

Ken Snell
<MS ACCESS MVP>


Scott B said:
Dear Ken,

Thanks for the quick reply and your help. I tried your language and the
OR does not seem to work. The "None" and the dates still work but it
does not filter out the future date correctly. For the record that has a
future date it displays "None". Any thoughts? By the way, does it
matter that the date is on a subform from a different query? I am only
displaying this on the main form to save constantly clicking back and
forth to see when the guest stayed last for tax purposes and to make sure
I have data entered on the subform. If I enter data on the form I will
always enter a stay start date.

Best regards,
Scott

Ken Snell said:
=IIf(IsNull([subfrmStays].Form!StayStart) Or
[subfrmStays].Form!StayStart >
Date(),"None",[subfrmStays].Form!StayStart)
--

Ken Snell
<MS ACCESS MVP>

Greetings,

I have the following IIf statement that works fine. I would like to
add an OR clause to make it not display the date if it is later than
today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the table
sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
Ken,

Don't you hate those pesky parenthesis. Got one mixed up. Your fix works
fine now. Many thanks.

Scott


Scott B said:
Ken,

If I understand what you asked, then the field that holds that data that
is being displayed on the main form is from the subform. The subform
reflects data from a query that sorts data from a guest stay table. The
field is called "staystart". It holds the date that a guest arrives at
our B&B. It is stored in the guest stay table. The data from that field
is enterd on the subform and displayed through the IIf statement
=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)
on the main form. The "staystart" field is a date/time field. Does this
help?

Scott


Ken Snell said:
If what I posted isn't working, it is likely that is because I guessed at
which "control" contains a "future" date and used that. So most likely my
expression isn't using the correct data.

You'll need to tell us more specifically what the controls hold, and what
you want to do (in words) within the expression.


--

Ken Snell
<MS ACCESS MVP>


Scott B said:
Dear Ken,

Thanks for the quick reply and your help. I tried your language and the
OR does not seem to work. The "None" and the dates still work but it
does not filter out the future date correctly. For the record that has
a future date it displays "None". Any thoughts? By the way, does it
matter that the date is on a subform from a different query? I am only
displaying this on the main form to save constantly clicking back and
forth to see when the guest stayed last for tax purposes and to make
sure I have data entered on the subform. If I enter data on the form I
will always enter a stay start date.

Best regards,
Scott

=IIf(IsNull([subfrmStays].Form!StayStart) Or
[subfrmStays].Form!StayStart >
Date(),"None",[subfrmStays].Form!StayStart)
--

Ken Snell
<MS ACCESS MVP>

Greetings,

I have the following IIf statement that works fine. I would like to
add an OR clause to make it not display the date if it is later than
today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the
table sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
Glad you got it working.

--

Ken Snell
<MS ACCESS MVP>

Scott B said:
Ken,

Don't you hate those pesky parenthesis. Got one mixed up. Your fix works
fine now. Many thanks.

Scott


Scott B said:
Ken,

If I understand what you asked, then the field that holds that data that
is being displayed on the main form is from the subform. The subform
reflects data from a query that sorts data from a guest stay table. The
field is called "staystart". It holds the date that a guest arrives at
our B&B. It is stored in the guest stay table. The data from that field
is enterd on the subform and displayed through the IIf statement
=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)
on the main form. The "staystart" field is a date/time field. Does this
help?

Scott


Ken Snell said:
If what I posted isn't working, it is likely that is because I guessed
at which "control" contains a "future" date and used that. So most
likely my expression isn't using the correct data.

You'll need to tell us more specifically what the controls hold, and
what you want to do (in words) within the expression.


--

Ken Snell
<MS ACCESS MVP>


Dear Ken,

Thanks for the quick reply and your help. I tried your language and
the OR does not seem to work. The "None" and the dates still work but
it does not filter out the future date correctly. For the record that
has a future date it displays "None". Any thoughts? By the way, does
it matter that the date is on a subform from a different query? I am
only displaying this on the main form to save constantly clicking back
and forth to see when the guest stayed last for tax purposes and to
make sure I have data entered on the subform. If I enter data on the
form I will always enter a stay start date.

Best regards,
Scott

=IIf(IsNull([subfrmStays].Form!StayStart) Or
[subfrmStays].Form!StayStart >
Date(),"None",[subfrmStays].Form!StayStart)
--

Ken Snell
<MS ACCESS MVP>

Greetings,

I have the following IIf statement that works fine. I would like to
add an OR clause to make it not display the date if it is later than
today.

=IIf(IsNull([subfrmStays].Form!StayStart),"None",[subfrmStays].Form!StayStart)

The label for the field says "Last Stay Date, but the data in the
table sometimes contains future dates as well as past dates.

Best regards,
Scott B
 
Back
Top