Click to See Complete Forum and Search --> : Microsoft VBScript runtime error '800a000d'


LilolProgrammer
12-16-2008, 09:32 AM
hello everyone,

i've come across this issue in which i'm entering a date save it to a database and redisplay the date. in the same field box that you would enter your date...

well it saves to the database but not in the correct format (dd/yy/yymm)
if i write 11/01/08 it will show in the database as 01/08/2011... the text field auto dates the data as you enter it...

i have a function that will convert it properly but as soon as i apply it i get that runtime error stating that the string ive entered is a type mismatch...

CODE:

function for the date conversion

function dateConv4(varDate)
if day(varDate) < 10 then
dd = "0" & day(varDate)
else
dd = day(varDate)
end if

if month(varDate) < 10 then
mm = "0" & month(varDate)
else
mm = month(varDate)
end if

dateConv4 = year(varDate)& mm & dd
end function

thanks in advanced

Kuriyama
12-16-2008, 09:55 AM
"well it saves to the database but not in the correct format (dd/yy/yymm)
if i write 11/01/08 it will show in the database as 01/08/2011... the text field auto dates the data as you enter it..."

ummm. . . that seems like a pretty important issue to address there. What type of DB are you using? How are you originally storing dates into that column. There is no easy way to sort via date entered on that table. bad bad bad!

As for the type mismatch there are only 2 places in your function that I see that could toss that error. They are when you do all those date functions on varDate. It could be that varDate isn't a date. Can you give me some sample data to run your function with?

LilolProgrammer
12-17-2008, 03:18 PM
kuriyama,
thanks for the reply

im using a mysql DB and im writing in dreamweaver (if that matters) well if i were to enter a date in this format(110108) the slashes will be automatically entered as if you were to be entering month day and year...

also i think the problem may reside on the fact that its making it into a string instead of a date format... but im not entirely sure about that...

Kuriyama
12-17-2008, 04:00 PM
Give me an example of what you are tossing into that function.