Printing blank dates as "TBD"?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that prints dates (they come in from a table column which is
date/time). In certain circumstances, when the dates are blank, the user
wants me to print "TBD". I have tried various ways to achieve this to no
avail , nothing seems to work. Any help appreciated. This was my latest
attempt (which does not work):

If Nz(Me!NOPRPubTarg, 0) = 0 Then
Me.NOPRPubTarg.Format = """TBD"""
Else
Me.NOPRPubTarg.Format = "Short Date"
End If

-David
 
You already asked this in the "getting started" group. One post per
question please.

=IIf (IsNull(Me!NOPRPubTarg), "TBD", Format(Me.NOPRPubTarg."Short Date"))


Not tested, but I think that will get you on the right track. No need to
put in code, just place in an unbound text box on your form or report.
 
According to the FAQ for these forums there is no prohibition against posting
a question in different discussion groups.
 
I think I have to use code since my criteria for doing this is more complex
than my example.
By the way I looked up the Format property in Access Help (before I posted
my question) and could not find any mention of the syntax you gave. Where did
you find it?
 
You can search Help on
"Format property date"
and scroll way to the bottom to see one example.

Then search Help on
"Format property numeric"
and scroll to the middle of the screen.

Keep in mind that a date is a number.
 
Maybe you can't find a "prohibition" in the FAQs at the MS site but I assure
you that it is considered undesireable by most of us who read through nearly
all threads in many news groups.
Read through this page http://www.mvps.org/access/netiquette.htm and you
will find:
====================
3. Multiposting is bad!
a. You commit the crime of multi-posting your questions by
posting the same question to several different newsgroups,
one at a time.
b. Several folks who could answer your questions take this
as a serious misuse of newsgroups and will likely ignore
your questions.
4. Crossposting is ok provided you include only the relevant newsgroups.
a. You can cross-post a message to different newsgroups by
including the newsgroup names separated by a semi-colon.
b. Obviously, this feature is easily and often abused.
c. Don't be too surprised if you get a email message
complaining about your cross-posted message!
====================
 
I think I have to use code since my criteria for doing this is more complex
than my example.
By the way I looked up the Format property in Access Help (before I posted
my question) and could not find any mention of the syntax you gave. Where did
you find it?

Had you Cross-posted instead of Multi-posted, you would see my
response here as well as in the other newsgroup.
I'll repeat it for others who may not have seen it there:

***********
Simply use the control's format property.
Set the control's format property to:

mm/dd/yyyy;mm/dd/yyyy;;"TBD"

See Access help on Format property + Number and Currency datatypes.

Change the mm/dd/yyyy to what ever other format you wish the date to
display as.
***********

Note: repeating the format in the negative section of the format
property is necessary if you have dates from before 12/30/1899,
otherwise you can just use mm/dd/yyyy;;;"TBD"
 
Back
Top