I am printing a daily report submitted online by our users and every record carries a date-time stamp. Is there a way to put a "New" tag for records that are less than 5 days old and that the tag will disappear if the record is older than 5 days?
Sure, use an if statement that compares the field's date value with now().
tell us more about how/where you would want
the flag, and we can get more specific.
it could be as simple as a label you set
visible to true or false based on that condition.
Thanks for the reply. I am trying to put a tag in the details section displaying alongside each individual record. More than likely it's just a matter of coding an IF statement. How would I code a control statement so that
IF [date_stamp] is less than 5 days old,
show "new" on the record
ELSE
show ""
I know I can do this in a query to test the days difference
IF DateDiff("d", [Date_Stamp], Now()) > 5
However, not sure how to insert such condition in a report control text box.
Well, you probably wouldn't put it in the control source...
like i originally suggested, how about making a lable
with the text "new" in the right spot, then click on
the background of the section it resides, choose
events, onformat event, code (rather than macro),
then place code something like this in the function
it builds:
if (IF DateDiff("d", <textbox holding date val>, Now()) > 5) then
<labelname>.visible = false
else
<labelname>.visible = true
end if
doublecheck datediff's definition in the help files
to make sure it's the same as the sql one you're
used to (probably is, but i'm not at my usual
computer right now to verify this myself)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.