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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date and datetime issue

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
In XI, I have a command parameter set to date but when I try to run the report, I get an error must be date time format. I don't understand why this is happening or where to look to resolve the issue.
Here is my formula. I get the error message on Month(Date({?StartDate}))
This is the last thing I have to resolve before I can say this report is done....Thanks in advance. lhuffst
Code:
WhilePrintingRecords;
Global DateVar Start;
Global DateVar End;
Local NumberVar Weeks; 
Local NumberVar Days; 
Local Numbervar Hol;
Global Numbervar TotDays;
Local Numbervar MonthNum;
Local NumberVar Weds;

Shared DateTimeVar Array Holidays;

If Month({Command.MYDATE}) =  01  Then
  If Month({Command.MYDATE}) = Month(Date({?StartDate})) and 
          Month({Command.MYDATE}) = Month(Date({?EndDate})) then
          (
           Start := Date({?StartDate});
           End := Date({?EndDate})
          )
    else
	(
	   Start := Date(Year({?StartDate}),01,01);
	   End := Date(Year({?EndDate}),01,31)
	)
 
Not sure why you are using a datetimevar array--you could just use datevar array. When checking for month, you can remove the date() since the month remains the same regardless of time. Why not set up the parameters as date parameters, too? You seem to be converting everything anyway.

-LB
 
LB, I copied code for the holidays from this site and it said to use datetime. I'll change that and see if it helps. The parameters are a date format but could the fact that I had one datetime variable mess up the parameters? Thanks for responding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top