Hi,
Below I have listed the code that I have in a grid. Basically the user enters a EIN/SSN twice into 2 different fields on the grid. This event is supposed to check to see if the 2 fields match. If so, then it puts the number into the correct format, otherwise it is supposed to generate an error message.
What happens is, if the 2 fields do not match, then a new blank record is displayed and the entry is ignored. No enter message is displayed. I took this error code listed below right from the help manual. If the 2 fields do match, then the record is saved as it should be.
Can someone tell me what is wrong with this code?
function CanInsertRecord as v (DataSubmitted as P, Args as p, PageVariables as p, Result as p)
with PageVariables
Result.Cancel = .f.
Result.ErrorHTML = ""
vfei1 = remspecial(DataSubmitted.Fei)
vfei2 = remspecial(DataSubmitted.Ssn)
vfeitype = alltrim(DataSubmitted.Feitype)
' error check to see if 2 entries match
if vfei1 <> vfei2 then
Result.Cancel = .t.
Result.ErrorHTML = "The FEI and FEI repeat do not match"
end if
if vfeitype = "EIN" then
DataSubmitted.Fei = Left(vfei1,2) + "-" + right(vfei1,7)
else if vfeitype <> "EIN"
DataSubmitted.Fei = Left(vfei1,3) + "-" + substr(vfei1,4,2) + "-" + right(vfei1,4)
end if
end with
end function
Below I have listed the code that I have in a grid. Basically the user enters a EIN/SSN twice into 2 different fields on the grid. This event is supposed to check to see if the 2 fields match. If so, then it puts the number into the correct format, otherwise it is supposed to generate an error message.
What happens is, if the 2 fields do not match, then a new blank record is displayed and the entry is ignored. No enter message is displayed. I took this error code listed below right from the help manual. If the 2 fields do match, then the record is saved as it should be.
Can someone tell me what is wrong with this code?
function CanInsertRecord as v (DataSubmitted as P, Args as p, PageVariables as p, Result as p)
with PageVariables
Result.Cancel = .f.
Result.ErrorHTML = ""
vfei1 = remspecial(DataSubmitted.Fei)
vfei2 = remspecial(DataSubmitted.Ssn)
vfeitype = alltrim(DataSubmitted.Feitype)
' error check to see if 2 entries match
if vfei1 <> vfei2 then
Result.Cancel = .t.
Result.ErrorHTML = "The FEI and FEI repeat do not match"
end if
if vfeitype = "EIN" then
DataSubmitted.Fei = Left(vfei1,2) + "-" + right(vfei1,7)
else if vfeitype <> "EIN"
DataSubmitted.Fei = Left(vfei1,3) + "-" + substr(vfei1,4,2) + "-" + right(vfei1,4)
end if
end with
end function
Comment