ms access - DateValue failure -
i've strange problem ms access vba datevalue function : fails type mismatch error when pass value "4 may 2012".
i think due internal date format, don't known how change @ code level format!
at moment solution is:
public function datetostr(value) dim parts variant parts = split(value, " ") dim month string select case parts(1) case "jan" month = "gen" case "may" month = "mag" case "jun" month = "giu" case "jul" month = "lug" case "aug" month = "ago" case "sep" month = "set" case "oct" month = "ott" case "dec" month = "dic" case else month = parts(1) end select datetostr = cdate(parts(0) & "/" & month & "/" & parts(2)) end function do have idea?!?
ps: environment italian.
in datevalue function
datevalue ("may 4, 2012") and make "may 4, 2012" ...
function datestr(sds string) '-- format input (sds) -> dd-mmm-yyyy - ex. "04-mag-2012" or "04 mag 2012" dim smonth string = "" select case mid(sds, 4, 3) case "gen" : smonth = "january" .... .... case "dic" : smonth = "december" end select datestr = smonth & " " & left(sds, 2) & ", " & right(sds, 4) end function
Comments
Post a Comment