Forum Moderators: open
I'm trying to edit some records in a Access DB I built that is stored on a Windows2000 webserver in USA. I am in Australia. Not sure if it has to do with date format differences. I can get the dates to display as I desire (dd/mm/yyyy), but it's when I try to update them that the server gives a "page cannot be displayed" error.
Here is my code:
Page1 (shown for convenience only):
<%' Convert Date if when hosted in USA -----------
function FormatDate(InDate)
if IsNull(InDate) then
FormatDate = ""
else
FormatDate = Day(InDate) & "/" & Month(InDate) & "/" & Year(InDate)
end if
end function
Dim DBconn, courses, RS
courses = "SELECT * FROM courseList WHERE ccode = '"&Request.Form("ccode")&"'"
DBconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\websites\DB.mdb;"
%>
<form name="edit" method="post" action="edCourse.asp">
<%
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open courses, DBconn 'get course info
RS.MoveFirst%>
<b>Program Type: </b><input type="text" name="progName" size="40" value="<%=RS("progName")%>">
<br><b>Location: </b><input type="text" name="location" value="<%=RS("location")%>">
<br><b>Day: </b><input type="text" name="day" value="<%=RS("day")%>">
<br><b>Date: </b><input type="text" name="date" value="<%=FormatDate(RS("date"))%>">
<%RS.Close
Set RS = Nothing
%>
<p/>
<input type="hidden" name="ccode" value="<%=Request.Form("ccode")%>">
<input type="submit" name="submit" value=" Commit Changes ">
<input type="reset" name="reset" value=" Clear Changes ">
</form>
Page2 (the page that does the work - well it's suppose to):
<% Dim edit_course, DBconn, RS
'edit_course = "UPDATE courseList SET progName = '"&Request.Form("progName")&"', location = '"&Request.Form("location")&"', date = '"&DateValue(Request.Form("date"))&"', day = '"&Request.Form("day")&"' WHERE ccode = '"&Request.Form("ccode")&"'"
edit_course = "UPDATE courseList SET progName = '"&Request.Form("progName")&"', location = '"&Request.Form("location")&"', day = '"&Request.Form("day")&"' WHERE ccode = '"&Request.Form("ccode")&"'"
DBconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\websites\DB.mdb;"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open edit_course, DBconn ' query to add coaching log entry
Set RS = Nothing
Response.Write edit_course
%>
<br>Course updated
<p><div align="center"><button type="button" onClick="history.go(-1)">Go Back</button></div>
If I leave out the date field it works fine, but not when I include it (commented out).
Please help,
TIA
rencat
I have checked out your options and also the recent thread, and I think I've tried everything suggested but it still don't work. For example, even if I put in a date of 4/4/2003, I still get an error.
I have not problem calling the date from the database (using ...WHERE date = #"&FormatDateUS(StrDate)&"#), but it just seems to be the insert/update operation that it don't like.
Thanks,
rencat
PS FormatDateUS is a function to convert the date obviously