afrausto
Posts: 66
|
| Posted: 09/27/2005, 10:41 AM |
|
Hello,
I have a Record Form that contains two dates: EventDate and TicketMailingDate. TicketMailingDate is a hidden text value.
I'm trying to set a date value to a TicketMailingDate in the Before Insert event. This is my code:
Dim EventDate
Request.Querystring("EventDate")
Donations.TicketMailingDate.value = DateAdd("d",-56,EventDate)
All dates are set to mm-dd-yyyy. When I submit a test form with an Event Date of 9/29/2006 the TicketMailingDate shows 11/4/1899.
Is there something I'm missing. Do I need to convert EventDate?
Thanks for your suggestions?
Albert
|
 |
 |
Edd
Posts: 547
|
| Posted: 09/28/2005, 7:37 AM |
|
Albert,
The reason you got a date 11/4/1899 was becase the date EventDate was empty.
Have you tried
Dim EventDate
EventDate = Donations.EventDate.Value
If Not IsEmpty(EventDate ) THen
Donations.TicketMailingDate.value = DateAdd("d",-56,EventDate)
End If
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
afrausto
Posts: 66
|
| Posted: 09/28/2005, 8:17 AM |
|
Edd,
Thanks for the insight. I was able to find a solution. The field Event Date is a required field in the form being submitted. So I knew it wasn't empty. It seems that in the Before Insert event I had set
Donations.EventDate.value = Request.Querystring("EventDate")
early in my code and later I set
EventCode = Request.Querystring("EventDate") (Not sure why I did this...)
I believe the second Request.Querystring("EventDate") for EventCode was cleared. That is why, as you pointed out, I was getting the strange date of 11/4/1899.
Anyways, this is what I did to resolve my issue:
Donations.TicketMailingDate.value = DateAdd("d",-56,Donations.EventDate.value)
Thanks again for your help.
Albert
|
 |
 |
|