Link to home
Start Free TrialLog in
Avatar of JPersinger
JPersinger

asked on

Is this acceptable code?

Hi -



I get an error : Invalid use of Null: 'CStr'

Here is a copy of the code:

<option value="<%=(rsProgramType.Fields.Item("education").Value)%>" <%if (CStr(rsProgramType.Fields.Item("education").Value) = CStr(RrsLookup.Fields.Item("edu_programtype1").Value)) then Response.Write("SELECTED") : Response.Write("")%>><%=(rsProgramType.Fields.Item("education").Value)%></option>

When I remove the CStr the page seems to load fine. Is it acceptable to remove the CStr from the above code?

There are two tables - one with the choices and the other used to store the value selected. When loading the load if the field is NULL I get the above error. When the field has data, I don't. This form has a lot of dropdowns, that may return blank the first time, but the next visit brings the data back.


Unless there is an easier way to detect a field is with data, I'm sure what to add here...
Avatar of Bernieq
Bernieq

It's just that cStr() cannot convert a Null to a string.

Try wrapping it in Trim() instead and you won't get the error message.

Or you could test for IsNull() and take the appropriate action based on the result of the test

The following example uses the IsNull function to determine whether a variable contains a Null:

Dim MyVar, MyCheck
MyCheck = IsNull(MyVar)      ' Returns False.

MyVar = Null                 ' Assign Null.
MyCheck = IsNull(MyVar)      ' Returns True.

MyVar = Empty                ' Assign Empty.
MyCheck = IsNull(MyVar)      ' Returns False.

Avatar of JPersinger

ASKER

Wrapping both with a Trim? Or just the one - (CStr(rsProgramType.Fields.Item("education").Value)? And can the trim work w/o the ISNull check?

Thanks

Jim
Here is an update version -

<select name="edu_sel_program1">
                <%
While (NOT rsProgramType.EOF)
%>
                <option value="<%= Trim((rsProgramType.Fields.Item("education").Value)) %>" <%if (CStr(Trim((rsProgramType.Fields.Item("education").Value))) = CStr(Trim((RrsLookup.Fields.Item("edu_programtype1").Value)))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsProgramType.Fields.Item("education").Value)) %></option>
                <%
  rsProgramType.MoveNext()
Wend
If (rsProgramType.CursorType > 0) Then
  rsProgramType.MoveFirst
Else
  rsProgramType.Requery
End If
%>
              </select>


And I still get the error...can you tell me more about the ISNULL code?

Jim
When there's a possibility that NULLS are comming through from the database, always do this
  RS.Field & ""

Null & "" = "" 

That works in plain VB and textboxes too....
Increasing the points - due to my lack of understanding...:)

Where in my code above do I add the rs.Field&"" or the Null&="" ?

Thanks

Jim



<option value="<%=(rsProgramType.Fields.Item"education").Value)%>"

<%

edu_value = rsProgramType.Fields.Item("education")
if isNull(edu_value) then
  edu_value = ""
end if

edu_prog = RrsLookup.Fields.Item("edu_programtype1")
if isNull(edu_prog) then
  edu_prog = ""
end if

if (edu_value = edu_prog) then Response.Write("SELECTED") : Response.Write("")%>>
<%=(rsProgramType.Fields.Item("education").Value)>
</option>
You can also detect this NULL value using your SQL Statement. If you are using SQL Server, there is ISNULL keyword to handle this NULL value.
Good to hear from you, again. I am using SQL2000. There are four pages that have this issue (with up to 3 controls each) - so what do you recommend?

Jim
sEducation = ""
If Not IsNull(rsProgramType("education")) Then
   sEducation = CStr(rsProgramType("education"))
End If
sEduType = ""
If Not IsNull(RrsLookup("edu_programtype1")) Then
   sEduType = CStr(RrsLookup("edu_programtype1"))
End If
If sEducation = sEduType Then
   sSelected = ""
Else
   sSelected = "Selected"
End If

Response.write("<option value=""" & sEducation & """ " & sSelected & ">" & sEducation & "</Option>")

Is this a big cleaner?
daniel_c

The code seems to work good with execption to this - It only returns one field and not all of them contained in the table - education. Here is a copy of my sql - would it be better to modify it?

<%
Dim RrsLookup__MMColParam
RrsLookup__MMColParam = "1"
if (Session("svUser") <> "") then RrsLookup__MMColParam = Session("svUser")
%>

<%
set RrsLookup = Server.CreateObject("ADODB.Recordset")
RrsLookup.ActiveConnection = MM_nl_conn_STRING
RrsLookup.Source = "SELECT id_num, userid, edu_date1, edu_date2, edu_date3, edu_institution1, edu_institution2, edu_institution3, edu_city1, edu_city2, edu_city3, edu_state1, edu_state2, edu_state3, edu_programtype1, edu_programtype2, edu_programtype3, edu_programdesc1, edu_programdesc2, edu_programdesc3 FROM dbo.resume WHERE userid = '" + Replace(RrsLookup__MMColParam, "'", "''") + "'"
RrsLookup.CursorType = 0
RrsLookup.CursorLocation = 2
RrsLookup.LockType = 3
RrsLookup.Open()
RrsLookup_numRows = 0
%>
<%
set rsProgramType = Server.CreateObject("ADODB.Recordset")
rsProgramType.ActiveConnection = MM_nl_conn_STRING
rsProgramType.Source = "SELECT education  FROM dbo.education"
rsProgramType.CursorType = 0
rsProgramType.CursorLocation = 2
rsProgramType.LockType = 3
rsProgramType.Open()
rsProgramType_numRows = 0
%>

Thanks

Jim
YOu say..
"SELECT education  FROM dbo.education"

Select columnNames1, ColumnNames2, etc..

You pick the column names you want on Select clause...

It is OK to say
"Select * from dbo.education"
but, it is better to show all the column names, it is a bit quicker recordset return

"Select columnname1, columnname2, columnname3, etc... from dbo.education"
yas -

Ok... thanks for the tip - I'll change it. Your code works to, but I still only get one return. Can someone help with the sql statement? Its looking like I need to change the code there since I have some many other controls that contain the same issue. Or I guess I can modify each control.

Help!

Thanks -

Jim

(again bumping the points up - you guys are great!)
<option value="<%=(rsProgramType.Fields.Item("education").Value)%>"

=>

<option value="<%=(rsProgramType.Fields.Item("education").Value & "")%>"
ASKER CERTIFIED SOLUTION
Avatar of daniel_c
daniel_c

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here it is - I added the & "" based on vindevogel mentioned) to each field ->

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/nl_conn.asp" -->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_nl_conn_STRING
  MM_editTable = "dbo.resume"
  MM_editColumn = "id_num"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "updatebuilder3.asp"
  MM_fieldsStr  = "edu_date1|value|edu_txt_institution|value|edu_txt_city1|value|edu_state1|value|edu_memo1_descript1|value|edu_date2|value|edu_txt_institution2|value|edu_txt_city2|value|edu_state2|value|edu_programtype2|value|edu_memo2_descript2|value|edu_date3|value|edu_txt_institution3|value|edu_txt_city3|value|edu_state3|value|edu_prgramtype3|value|edu_memo3_descript3|value|user_id|value"
  MM_columnsStr = "edu_date1|',none,''|edu_institution1|',none,''|edu_city1|',none,''|edu_state1|',none,''|edu_programdesc1|',none,''|edu_date2|',none,''|edu_institution2|',none,''|edu_city2|',none,''|edu_state2|',none,''|edu_programtype2|',none,''|edu_programdesc2|',none,''|edu_date3|',none,''|edu_institution3|',none,''|edu_city3|',none,''|edu_state3|',none,''|edu_programtype3|',none,''|edu_programdesc3|',none,''|userid|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
set rsStates = Server.CreateObject("ADODB.Recordset")
rsStates.ActiveConnection = MM_nl_conn_STRING
rsStates.Source = "SELECT *  FROM dbo.states"
rsStates.CursorType = 0
rsStates.CursorLocation = 2
rsStates.LockType = 3
rsStates.Open()
rsStates_numRows = 0
%>
<%
set rsJobTitles = Server.CreateObject("ADODB.Recordset")
rsJobTitles.ActiveConnection = MM_nl_conn_STRING
rsJobTitles.Source = "SELECT id_num, jobtitles  FROM dbo.job_titles"
rsJobTitles.CursorType = 0
rsJobTitles.CursorLocation = 2
rsJobTitles.LockType = 3
rsJobTitles.Open()
rsJobTitles_numRows = 0
%>
<%
Dim RrsLookup__MMColParam
RrsLookup__MMColParam = "1"
if (Session("svUser") <> "") then RrsLookup__MMColParam = Session("svUser")
%>
<%
set RrsLookup = Server.CreateObject("ADODB.Recordset")
RrsLookup.ActiveConnection = MM_nl_conn_STRING
RrsLookup.Source = "SELECT id_num, userid, edu_date1, edu_date2, edu_date3, edu_institution1, edu_institution2, edu_institution3, edu_city1, edu_city2, edu_city3, edu_state1, edu_state2, edu_state3, edu_programtype1, edu_programtype2, edu_programtype3, edu_programdesc1, edu_programdesc2, edu_programdesc3 FROM dbo.resume WHERE userid = '" + Replace(RrsLookup__MMColParam, "'", "''") + "'"
RrsLookup.CursorType = 0
RrsLookup.CursorLocation = 2
RrsLookup.LockType = 3
RrsLookup.Open()
RrsLookup_numRows = 0
%>
<%
set rsProgramType = Server.CreateObject("ADODB.Recordset")
rsProgramType.ActiveConnection = MM_nl_conn_STRING
rsProgramType.Source = "SELECT education  FROM dbo.education"
rsProgramType.CursorType = 0
rsProgramType.CursorLocation = 2
rsProgramType.LockType = 3
rsProgramType.Open()
rsProgramType_numRows = 0
%>
<%
If Session("svAccess") <> "public" Then
Response.Redirect("NeedToLogin.asp")
End If
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>                              
function DoDateTime(str, nNamedFormat, nLCID)                        
      dim strRet                                                
      dim nOldLCID                                                
                                                            
      strRet = str                                                
      If (nLCID > -1) Then                                          
            oldLCID = Session.LCID                                    
      End If                                                      
                                                            
      On Error Resume Next                                          
                                                            
      If (nLCID > -1) Then                                          
            Session.LCID = nLCID                                    
      End If                                                      
                                                            
      If ((nLCID < 0) Or (Session.LCID = nLCID)) Then                        
            strRet = FormatDateTime(str, nNamedFormat)                  
      End If                                                      
                                                            
      If (nLCID > -1) Then                                          
            Session.LCID = oldLCID                                    
      End If                                                      
                                                            
      DoDateTime = strRet                                          
End Function                                                      
</SCRIPT>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}

// Check browser version
var isNav4 = false, isNav5 = false, isIE4 = false
var strSeperator = "/";
// If you are using any Java validation on the back side you will want to use the / because
// Java date validations do not recognize the dash as a valid date separator.
var vDateType = 3; // Global value for type of date format
//                1 = mm/dd/yyyy
//                2 = yyyy/dd/mm  (Unable to do date check at this time)
//                3 = dd/mm/yyyy
var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape
var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
var err = 0; // Set the error code to a default of zero
if(navigator.appName == "Netscape") {
if (navigator.appVersion < "5") {
isNav4 = true;
isNav5 = false;
}
else
if (navigator.appVersion > "4") {
isNav4 = false;
isNav5 = true;
   }
}
else {
isIE4 = true;
}
function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
vDateType = dateType;
// vDateName = object name
// vDateValue = value in the field being checked
// e = event
// dateCheck
// True  = Verify that the vDateValue is a valid date
// False = Format values being entered into vDateValue only
// vDateType
// 1 = mm/dd/yyyy
// 2 = yyyy/mm/dd
// 3 = dd/mm/yyyy
//Enter a tilde sign for the first number and you can check the variable information.
if (vDateValue == "~") {
alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
vDateName.value = "";
vDateName.focus();
return true;
}
var whichCode = (window.Event) ? e.which : e.keyCode;
// Check to see if a seperator is already present.
// bypass the date if a seperator is present and the length greater than 8
if (vDateValue.length > 8 && isNav4) {
if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
return true;
}
//Eliminate all the ASCII codes that are not valid
var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
if (alphaCheck.indexOf(vDateValue) >= 1) {
if (isNav4) {
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
else {
vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
return false;
   }
}
if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
return false;
else {
//Create numeric string values for 0123456789/
//The codes provided include both keyboard and keypad values
var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
if (strCheck.indexOf(whichCode) != -1) {
if (isNav4) {
if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {
alert("Invalid Date\nPlease Re-Enter");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
if (vDateValue.length == 6 && dateCheck) {
var mDay = vDateName.value.substr(2,2);
var mMonth = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
//Turn a two digit year into a 4 digit year
if (mYear.length == 2 && vYearType == 4) {
var mToday = new Date();
//If the year is greater than 30 years from now use 19, otherwise use 20
var checkYear = mToday.getFullYear() + 30;
var mCheckYear = '20' + mYear;
if (mCheckYear >= checkYear)
mYear = '19' + mYear;
else
mYear = '20' + mYear;
}
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (!dateValid(vDateValueCheck)) {
alert("Invalid Date\nPlease Re-Enter");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
return true;
}
else {
// Reformat the date for validation and set date type to a 1
if (vDateValue.length >= 8  && dateCheck) {
if (vDateType == 1) // mmddyyyy
{
var mDay = vDateName.value.substr(2,2);
var mMonth = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
}
if (vDateType == 2) // yyyymmdd
{
var mYear = vDateName.value.substr(0,4)
var mMonth = vDateName.value.substr(4,2);
var mDay = vDateName.value.substr(6,2);
vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
}
if (vDateType == 3) // ddmmyyyy
{
var mMonth = vDateName.value.substr(2,2);
var mDay = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
}
//Create a temporary variable for storing the DateType and change
//the DateType to a 1 for validation.
var vDateTypeTemp = vDateType;
vDateType = 1;
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (!dateValid(vDateValueCheck)) {
alert("Invalid Date\nPlease Re-Enter");
vDateType = vDateTypeTemp;
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
vDateType = vDateTypeTemp;
return true;
}
else {
if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
alert("Invalid Date\nPlease Re-Enter");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
         }
      }
   }
}
else {
// Non isNav Check
if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
alert("Invalid Date\nPlease Re-Enter");
vDateName.value = "";
vDateName.focus();
return true;
}
// Reformat date to format that can be validated. mm/dd/yyyy
if (vDateValue.length >= 8 && dateCheck) {
// Additional date formats can be entered here and parsed out to
// a valid date format that the validation routine will recognize.
if (vDateType == 1) // mm/dd/yyyy
{
var mMonth = vDateName.value.substr(0,2);
var mDay = vDateName.value.substr(3,2);
var mYear = vDateName.value.substr(6,4)
}
if (vDateType == 2) // yyyy/mm/dd
{
var mYear = vDateName.value.substr(0,4)
var mMonth = vDateName.value.substr(5,2);
var mDay = vDateName.value.substr(8,2);
}
if (vDateType == 3) // dd/mm/yyyy
{
var mDay = vDateName.value.substr(0,2);
var mMonth = vDateName.value.substr(3,2);
var mYear = vDateName.value.substr(6,4)
}
if (vYearLength == 4) {
if (mYear.length < 4) {
alert("Invalid Date\nPlease Re-Enter");
vDateName.value = "";
vDateName.focus();
return true;
   }
}
// Create temp. variable for storing the current vDateType
var vDateTypeTemp = vDateType;
// Change vDateType to a 1 for standard date format for validation
// Type will be changed back when validation is completed.
vDateType = 1;
// Store reformatted date to new variable for validation.
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (mYear.length == 2 && vYearType == 4 && dateCheck) {
//Turn a two digit year into a 4 digit year
var mToday = new Date();
//If the year is greater than 30 years from now use 19, otherwise use 20
var checkYear = mToday.getFullYear() + 30;
var mCheckYear = '20' + mYear;
if (mCheckYear >= checkYear)
mYear = '19' + mYear;
else
mYear = '20' + mYear;
vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
// Store the new value back to the field.  This function will
// not work with date type of 2 since the year is entered first.
if (vDateTypeTemp == 1) // mm/dd/yyyy
vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
if (vDateTypeTemp == 3) // dd/mm/yyyy
vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
}
if (!dateValid(vDateValueCheck)) {
alert("Invalid Date\nPlease Re-Enter");
vDateType = vDateTypeTemp;
vDateName.value = "";
vDateName.focus();
return true;
}
vDateType = vDateTypeTemp;
return true;
}
else {
if (vDateType == 1) {
if (vDateValue.length == 2) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 5) {
vDateName.value = vDateValue+strSeperator;
   }
}
if (vDateType == 2) {
if (vDateValue.length == 4) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 7) {
vDateName.value = vDateValue+strSeperator;
   }
}
if (vDateType == 3) {
if (vDateValue.length == 2) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 5) {
vDateName.value = vDateValue+strSeperator;
   }
}
return true;
   }
}
if (vDateValue.length == 10&& dateCheck) {
if (!dateValid(vDateName)) {
// Un-comment the next line of code for debugging the dateValid() function error messages
//alert(err);  
alert("Invalid Date\nPlease Re-Enter");
vDateName.focus();
vDateName.select();
   }
}
return false;
}
else {
// If the value is not in the string return the string minus the last
// key entered.
if (isNav4) {
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
else
{
vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
return false;
         }
      }
   }
}
function dateValid(objName) {
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
// var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
//strDate = datefield.value;
strDate = objName;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
//Adjustment for short years entered
if (strYear.length == 2) {
strYear = '20' + strYear;
}
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
   }
}
else {
if (intday > 28) {
err = 10;
return false;
      }
   }
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
//  End -->
</script>
<title>Welcome to the Resume' Builder</title>
<style type="text/css">
<!--
-->
</style>
<link rel="stylesheet" href="/masterbold.css" type="text/css">
<link rel="stylesheet" href="/masterfont.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" >
<p class="fonts">&nbsp;</p>
<table border="1" width="600">
  <tr>
    <td width="605" height="1051" valign="top">
      <table style=" width=605 border="0" cellspacing="2" cellpadding="8" align="" width="605"">
        <form ACTION="<%=MM_editAction%>" METHOD="POST" name="resume" >
          <tr>
            <td height="32" valign="middle" colspan="4" class="masterbold" bgcolor="#FFFFFF" align="center"><font face="Arial, Helvetica, sans-serif" size="5" color="#99CC66"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">Resume
              Builder for</font><font color="#000066" size="2"><b> <font face="Verdana, Arial, Helvetica, sans-serif"><%= Session("svUser") %></font></b></font></font></td>
            <td width="33"></td>
          </tr>
          <tr>
            <td height="34" valign="top" colspan="2" class="masterbold" bgcolor="#FFFFFF">
              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To
                Search for a job, click <a href="searchjobs.asp">here</a>.</font></div>
            </td>
            <td valign="top" colspan="2" bgcolor="#FFFFFF" class="masterbold"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">For
              all dates use the following format: mm/dd/yyyy</font></td>
            <td></td>
          </tr>
          <tr>
            <td valign="top" colspan="2" class="masterbold" bgcolor="#FFFFFF" height="32">
              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To
                edit your profile, click <a href="passwordEDIT.asp" target="_parent">here</a>.</font></div>
            </td>
            <td valign="top" colspan="2" bgcolor="#FFFFFF" class="masterbold">
              <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To
                end your session click <a href="logout.asp">here</a>.</font>
            </td>
            <td></td>
          </tr>
          <tr bgcolor="#0099CC">
            <td height="0" width="130"></td>
            <td width="82"></td>
            <td width="191"></td>
            <td width="70"></td>
            <td></td>
          </tr>
          <tr>
            <td valign="top" class="masterbold" bgcolor="#0099CC" nowrap height="32"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Step
              2: Education</b></font></td>
            <td colspan="3" valign="top" class="masterbold" bgcolor="#0099CC">
              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Detail
                Your Education</font></div>
            </td>
            <td></td>
          </tr>
          <tr>
            <td height="0"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" align="left" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Date:</font></td>
            <td colspan="3" valign="middle" class="masterfont">
              <input value="<%=(DoDateTime((RrsLookup.Fields.Item("edu_date1").Value), 2, 1033))%>" type="text" name="edu_date1" size='10' maxlength="10" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Institution:</font></td>
            <td colspan="3" valign="middle">
              <input value="<%=(RrsLookup.Fields.Item("edu_institution1").Value)%>" type="text" name="edu_txt_institution" size="50">
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Location:</font></td>
            <td colspan="3" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">City:</font>
              <input value="<%=(RrsLookup.Fields.Item("edu_city1").Value)%>" type="text" name="edu_txt_city1">
              <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">State:</font>
              <select name="edu_state1">
                <%
While (NOT rsStates.EOF)
%>
                <option value="<%= Trim((rsStates.Fields.Item("states").Value & "")) %>" <%if (CStr(Trim((rsStates.Fields.Item("states").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_state1").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsStates.Fields.Item("states").Value & "")) %></option>
                <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="35"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">Program
              Type:</font></td>
            <td colspan="3" valign="middle">
              <select name="select">
                <%
While (NOT rsProgramType.EOF)
%>
                <option value="<%=(rsProgramType.Fields.Item("education").Value & "")%>" <%if (CStr(Trim((rsProgramType.Fields.Item("education").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_programtype1").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsProgramType.Fields.Item("education").Value & "")) %></option>
                <%
  rsProgramType.MoveNext()
Wend
If (rsProgramType.CursorType > 0) Then
  rsProgramType.MoveFirst
Else
  rsProgramType.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="96"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Program
              Description:</font></td>
            <td colspan="2" valign="middle">
              <textarea name="edu_memo1_descript1" cols="50" rows="3" wrap="virtual"><%=(RrsLookup.Fields.Item("edu_programdesc1").Value)%></textarea>
            </td>
            <td valign="top">
              <input type="image" src="images/nextbutton.gif" width="53" height="18" name="B12" border="0" alt="done"">
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Date:</font></td>
            <td colspan="3" valign="top" class="masterfont">
              <input value="<%=(RrsLookup.Fields.Item("edu_date2").Value)%>" type="text" name="edu_date2" size='10' maxlength="10" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Institution:</font></td>
            <td colspan="3" valign="top">
              <input value="<%=(RrsLookup.Fields.Item("edu_institution2").Value)%>" type="text" name="edu_txt_institution2" size="50">
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Location:</font></td>
            <td colspan="3" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">City:</font>
              <input value="<%=(RrsLookup.Fields.Item("edu_city2").Value)%>" type="text" name="edu_txt_city2">
              <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">State:</font>
              <select name="edu_state2">
                <%
While (NOT rsStates.EOF)
%>
                <option value="<%= Trim((rsStates.Fields.Item("states").Value & "")) %>" <%if (CStr(Trim((rsStates.Fields.Item("states").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_state2").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsStates.Fields.Item("states").Value & "")) %></option>
                <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td class="masterbold" valign="middle" nowrap height="35"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">Program
              Type:</font></td>
            <td colspan="3" valign="middle">
              <select name="edu_programtype2">
                <%
While (NOT rsProgramType.EOF)
%>
                <option value="<%= Trim((rsProgramType.Fields.Item("education").Value & "")) %>" <%if (CStr(Trim((rsProgramType.Fields.Item("education").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_programtype2").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsProgramType.Fields.Item("education").Value & "")) %></option>
                <%
  rsProgramType.MoveNext()
Wend
If (rsProgramType.CursorType > 0) Then
  rsProgramType.MoveFirst
Else
  rsProgramType.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="96"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Program
              Description:</font></td>
            <td colspan="2" valign="top">
              <textarea name="edu_memo2_descript2" cols="50" rows="3" wrap="virtual"><%=(RrsLookup.Fields.Item("edu_programdesc2").Value)%></textarea>
            </td>
            <td valign="middle" align="center">
              <input type="image" src="images/nextbutton.gif" width="53" height="18" name="B13" border="0" alt="done"">
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Date:</font></td>
            <td colspan="3" valign="top">
              <input value="<%=(RrsLookup.Fields.Item("edu_date3").Value)%>" type="text" name="edu_date3" size='10' maxlength="10" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Institution:</font></td>
            <td colspan="3" valign="top">
              <input value="<%=(RrsLookup.Fields.Item("edu_institution3").Value)%>" type="text" name="edu_txt_institution3" size="50">
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="44"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Location:</font></td>
            <td colspan="3" valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">City:</font>
              <input value="<%=(RrsLookup.Fields.Item("edu_city3").Value)%>" type="text" name="edu_txt_city3">
              <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">State:</font>
              <select name="edu_state3">
                <%
While (NOT rsStates.EOF)
%>
                <option value="<%= Trim((rsStates.Fields.Item("states").Value & "")) %>" <%if (CStr(Trim((rsStates.Fields.Item("states").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_state3").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsStates.Fields.Item("states").Value & "")) %></option>
                <%
  rsStates.MoveNext()
Wend
If (rsStates.CursorType > 0) Then
  rsStates.MoveFirst
Else
  rsStates.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="35"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">Program
              Type:</font></td>
            <td colspan="3" valign="middle">
              <select name="edu_prgramtype3">
                <%
While (NOT rsProgramType.EOF)
%>
                <option value="<%= Trim((rsProgramType.Fields.Item("education").Value & "")) %>" <%if (CStr(Trim((rsProgramType.Fields.Item("education").Value & ""))) = CStr(Trim((RrsLookup.Fields.Item("edu_programtype3").Value & "")))) then Response.Write("SELECTED") : Response.Write("")%>><%= Trim((rsProgramType.Fields.Item("education").Value & "")) %></option>
                <%
  rsProgramType.MoveNext()
Wend
If (rsProgramType.CursorType > 0) Then
  rsProgramType.MoveFirst
Else
  rsProgramType.Requery
End If
%>
              </select>
            </td>
            <td></td>
          </tr>
          <tr>
            <td valign="middle" class="masterbold" height="96"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Program
              Description:</font></td>
            <td colspan="2" valign="top">
              <textarea name="edu_memo3_descript3" cols="50" rows="3" wrap="virtual"><%=(RrsLookup.Fields.Item("edu_programdesc3").Value)%></textarea>
            </td>
            <td valign="middle" align="center">
              <input type="image" src="images/nextbutton.gif" width="53" height="18" name="B14" border="0" alt="done"">
            </td>
            <td></td>
          </tr>
          <tr>
            <td height="0"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td colspan="3" valign="top" height="36">&nbsp;</td>
            <td valign="middle" align="center">
              <input type="image" src="images/donebutton.gif" width="53" height="18" name="B17" border="0" alt="done"">
            </td>
            <td></td>
          </tr>
          <tr>
            <td height="0"></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td height="34"><img height="1" width="113" src="/images/spacer.gif">
              <input type="hidden" name="user_id" value="<%= Session("svUser") %>">
            </td>
            <td><img height="1" width="83" src="/images/spacer.gif"></td>
            <td colspan="2" valign="top"><img height="1" width="75" src="/images/spacer.gif"></td>
            <td></td>
          </tr>
          <input type="hidden" name="MM_update" value="true">
          <input type="hidden" name="MM_recordId" value="<%= RrsLookup.Fields.Item("id_num").Value %>">
        </form>
      </table>
    </td>
  </tr>
  <tr>
    <td height="1"></td>
  </tr>
</table>
<div>
  <div align="center">
    <div>
      <p>&nbsp;</p>
    </div>
  </div>
</div>
</html>
<%
rsStates.Close()
%>
<%
rsJobTitles.Close()
%>
<%
RrsLookup.Close()
%>
<%
rsProgramType.Close()
%>
Try

If Not rsProgramType.eof Then
rsProgramType.movefirst
End If
I just happen to find this..

     <table style=" width=605 border="0" cellspacing="2" cellpadding="8" align="" width="605"">

You don't have anything on style part..

Delete Style="

Also same line..
width="605"">

Dlete extra "

Another one.. (three or four places, search for this string)
alt="done"">

delete extra "

Sorry for the delay - I thought I already graded your response.

Jim