Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: dates... again


Message #1 by "Carlos Lamar" <lamar@s...> on Fri, 19 Jul 2002 16:26:45 -0700
Hello,

I am using the following code to update a date field in an Access
database:

If len(trim(Request("sd"))) =3D "" Then
		rs("start_date") =3D NULL
	Else
		rs("start_date") =3D Request("sd")
	End If

The system is displaying the message "Type mismatch".  The variable "sd"
has the format "mm/dd/yy".
Any help will be greatly appreciated.

Thanks,
---Carlos

____________________________________________________
Carlos L. LaMar
Executive VP, IS & Management Development
snyder/newell, inc.
> *:   xxx.xxx.xxxx
> *:   xxx.xxx.xxxx   (FAX)
> *:  clamar@s...
> u http://www.snyder-newell.com/
>
>
>
Message #2 by "Larry Woods" <larrywoods@c...> on Fri, 19 Jul 2002 17:22:57 -0700
Assuming that the date is entered correctly, convert the string
to a date field:

rs("start_date")=CDate(Request("sd"))

Best to do this instead:

If Not IsDate(Request("sd")) Then
	' Error...handle it
Else
	rs("start_date")=CDate(Request("sd"))
End If


Hope that this helps...

Larry Woods


> -----Original Message-----
> From: Carlos Lamar [mailto:lamar@s...]
> Sent: Friday, July 19, 2002 4:27 PM
> To: ASP Web HowTo
> Subject: [asp_web_howto] dates... again
>
>
> Hello,
>
> I am using the following code to update a date field
> in an Access
> database:
>
> If len(trim(Request("sd"))) = "" Then
> 		rs("start_date") = NULL
> 	Else
> 		rs("start_date") = Request("sd")
> 	End If
>
> The system is displaying the message "Type mismatch".
> The variable "sd"
> has the format "mm/dd/yy".
> Any help will be greatly appreciated.
>
> Thanks,
> ---Carlos
>
> ____________________________________________________
> Carlos L. LaMar
> Executive VP, IS & Management Development
> snyder/newell, inc.
> > *:   xxx.xxx.xxxx
> > *:   xxx.xxx.xxxx   (FAX)
> > *:  clamar@s...
> > u http://www.snyder-newell.com/
> >
> >
> >
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=n
osim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/thepr
ogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/thepr
ogramme
r-20


  Return to Index