Reply
 
LinkBack Thread Tools Display Modes
Old 06-21-2009, 04:10 AM   #1 (permalink)
CrystalHacker
Guest
 
Posts: n/a
Default Dates as Parameters and Date Math Confusion

I am trying to create a Service contract.

I want to import a Date (CurrentContractExpires) via report parameters and then add 365 days to calculate an EndOfContractdate.

There is no Date parameter type so I used String with an input value "#07/01/2009#"

I tried A few different VB Date functions, but no luck so far.

VB did not seem to like "Date.TryParse()"

I assume CDate and DateAdd are required.

-ch
  Reply With Quote
Old 06-21-2009, 04:54 AM   #2 (permalink)
CrystalHacker
Guest
 
Posts: n/a
Default

This seems to work, but it looks rather ugly...

Private datContractExpiresOn As Date
Private datNewWarrantyEndsOn As Date


'consume Expiration Date Parameter and assign it to contractExpiresOn

Dim ExpDateParam As object = ReportUtilities.ReturnParameterValue("ExpirationDa te")

datContractExpiresOn=CDate(ExpDateParam)
datNewWarrantyEndsOn=DateAdd("d",365,datContractEx piresOn)

I couldn't figure out how to handle the case when the parameter was left out.
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:48 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
D-Tools, Inc.