Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to print a line when DateTime changes from AM to PM

Status
Not open for further replies.

GZook

Programmer
Apr 14, 2003
42
US
I'm trying to use "gampm = Right(CTime({datetimefield}),2)" to get the AM/PM part of the DateTime field. However I get the message "A string is required here" with the cursor positioned after "Right(". What type does CTime() return? How should I accomplish this?
 
To detect if it's AM/PM try:

@AMPM
if hour({datetimefield}) <= 12 then
"AM"
else
"PM"

Insert a new detail (or whaatever) section and size it for the blank line. Right click the new section and select format section->X 2 next to suppress

previous(@AMPM) = @AMPM

Should do it...

-k
 
You had an = sign that shouldn't've been.

IF hour({datetimefield}) < 12 then
"AM"
else
"PM"
 
It kind of worked. However, the line appears after the first PM. It should be before.

I'm just gonna make a Group by @AMPM and put the line in that group header.
 
It kind of worked. The line appeared after the first PM. I believe this may be because I have my detail fields in a group header to avoid a list of duplicate records. The AM PM line is in that group footer.

I'll just add a parent group based on @AMPM and put the line in that group header. We'll see how that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top