function checkForm(theForm)
{
	// Check DSN.
	if ( !checkHasValue( theForm.datasourcename, "TEXT" ) )
		if ( !onError( theForm, theForm.datasourcename, theForm.datasourcename.value, 
			"Please supply a value for\nthe DSN field." ) )
			return false;	
	invalidChars = "!@*()={}[];,?\\";
	if ( !checkValidChars( theForm.datasourcename.value, true, true, true, invalidChars, false ) )
		if ( !onError( theForm, theForm.datasourcename, theForm.datasourcename.value, 
			 "The DSN may contain letters, numbers, spaces,\n"
			+"and special characters excluding: " + invalidChars ) )
			return false;
	
	// Check directory.
	if(theForm.typeofdb.options[theForm.typeofdb.options.selectedIndex].value != "sql"){
	if ( !checkHasValue( theForm.locationdirectory, "TEXT" ) )
		if ( !onError( theForm, theForm.locationdirectory, theForm.locationdirectory.value, 
			"Please supply a value for\nthe filename field." ) )
			return false;	
	invalidChars = "/:*?<>|";
	if ( !checkValidChars( theForm.locationdirectory.value, true, true, true, invalidChars, false ) )
		if ( !onError( theForm, theForm.locationdirectory, theForm.locationdirectory.value, 
			 "The filename may contain letters, numbers, spaces,\n"
			+"and special characters excluding: " + invalidChars ) )
			return false;
		}	
			
  //If SQL is selected check SQL fields
   if (theForm.typeofdb.options[theForm.typeofdb.options.selectedIndex].value == "sql"){
      	// Check IP.
		
	if (!checkIPAddress(theForm.sqlip.value))
	    if ( !onError( theForm, theForm.sqlip, theForm.sqlip.value, "The IP address appears to invalid.\nPlease try entering the address." ) )
			return false;
			
			
	// Check user name.
	if ( !checkHasValue(theForm.sqlusername,"TEXT"))
		if ( !onError( theForm, theForm.sqlusername, theForm.sqlusername.value, 
			"Please supply a value for\nthe user name field." ) )
			return false;			
			
	}				

	return true;
} 

//document.frmMain.datasourcename.focus();
