Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having a problem when a field on the spreadsheet is blank. I
should be getting an error message passed back to the screen telling the user that the field is blank. But instead I am getting an error message that points to another field that has been filled in. The users are able to select from a drop down list either a pre-existing Excel spreadsheet or a blank spreadsheet where they can enter the data. When they click the Store button, I am using Javascript to validate the fields. If a particular field is not entered or has invalid data, then an error message will appear on the screen. In this case, I was testing for a blank field and did not get the error message I was expecting. So I put in some Response.Write statements to display what was in the field and in this case this is where it showed up as undefined. If there is data in the field, then the field displays correctly. The following is an example of the code: do { indexRow+=1; } while (mExcelApp.ActiveSheet.Cells(indexRow, 1) != "RECORD"); indexRow+=2; RecordCount = 0; do { var xlSourceDoc = mExcelApp.ActiveSheet.Cells(indexRow, 2); var xlRefNumber = mExcelApp.ActiveSheet.Cells(indexRow, 3); var xlFYR = mExcelApp.ActiveSheet.Cells(indexRow, 4); var xlClass = mExcelApp.ActiveSheet.Cells(indexRow, 5); var xlNNNNN = mExcelApp.ActiveSheet.Cells(indexRow, 6); var xlAAAA = mExcelApp.ActiveSheet.Cells(indexRow, 7); var xlLLLL = mExcelApp.ActiveSheet.Cells(indexRow, 8); var xlFFF = mExcelApp.ActiveSheet.Cells(indexRow, 9); var xlLineDollarAmt = mExcelApp.ActiveSheet.Cells(indexRow, 10); var xlLineUnits = mExcelApp.ActiveSheet.Cells(indexRow, 11); var xlLineDesc = mExcelApp.ActiveSheet.Cells(indexRow, 12); if ((xlSourceDoc == "") || (xlSourceDoc == null) || (xlSourceDoc == "undefined")) { mError = 11; mResults = showErrorMsg(); break; } if ((xlRefNumber == null) || (xlRefNumber == "undefined") || (xlRefNumber == "")) { mError = 12; mResults = showErrorMsg(); break; } var xlFYRStr = String(xlFYR); var xlFYRFirstChar = xlFYRStr.substr(0, 1); var xlFYRLastTwoChar = xlFYRStr.substr(1, 2); if (xlFYRFirstChar == "f" || xlFYRFirstChar == "p" || xlFYRFirstChar == "F" || xlFYRFirstChar == "P" || xlFYRFirstChar == "") { return true; } else { mError = 13; mResults = showErrorMsg(); break; } <code trimmed RecordCount+=1; indexRow+=1; } while (RecordCount < xlRecCnt); In showErrorMsg() is where I have my error messages defined and mError = xx returns a particular message. In this instance of my testing, I left xlSourceDoc blank and should get error message #11. But instead I am getting the error message #13, associated with the xlFYR field. Being fairly new to both Excel and Javascript, I am at a lost as to how to correct the problem. Does anyone have an idea what I need to do? TIA for any help! Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Functions Undefined | Excel Worksheet Functions | |||
Error: Undefined or non-rectangular name | Excel Worksheet Functions | |||
how do I insert a variable amount of blank spaces in a formula? | Excel Worksheet Functions | |||
Undefined function error | Excel Discussion (Misc queries) | |||
test for not blank, use value in cell and set as variable | Excel Discussion (Misc queries) |