I have added programing to my form to guide the user to enter the correct information properly and added restriction to the form to ensure this as well. However all a user has to do to get around this is enter the add data mode and press F10 each time they do this a blank record is added. I am having a hard time trying to figure out what in my code could be causing this here in the code. I do apologize as it is long.
var vLength as int = 0 // Variable for length error test
var vMessage as string = "" // Variable used to generate custom error message
if @isblank(ThisElement) then
{
// Check to make sure that the short form is not blank.
if @isblank(ThisElement) then vEntryErrorCount = vEntryErrorCount + 1 //Error variable counts a few times before getting in the users face
if @isblank(ThisElement) and vEntryErrorCount > 3 then @MsgBox("You seem to be having some trouble here.","You must enter a Short Form.","Without it this record is useless!")
if @isblank(ThisElement) then
{
@msg("WARNING! ShortForm IS A REQIRED FIELD")
@Play("Beep")
throwfocus(ThisElement)
}
}
else
{
// Check to make sure the Short Form is 2 to 5 Characters long
vWork = 0;
vWork = @tn(@len(ThisElement)); //Put the length of the short form in the variable.
if vWork < "2" or vWork > "6" then vLength = 1 else vLength = 0;
if vLength = 1 then vEntryErrorCountA = (vEntryErrorCountA + 1) //Error variable counts a few times before getting in the users face
if vLength = 1 and (vEntryErrorCountA > 3) then @MsgBox("You seem to be having some trouble here.","A Short Form must be 2 to 6 characters long.","Please try again!")
if vLength = 1 then
{
@msg ("WARNING! THIS FIELD MUST BE 2 TO 6 CHARACTERS")
@Play("Beep")
throwfocus(ThisElement)
}
}
// Check to see if the Short Form already exists in the database if this is a new record that has not been save yet
ThisElement = ToUpper(ThisElement) // Converts this field to upper case
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!ShortForm","ShortForm")) and (not @error) and @IsNew then
{
vEntryErrorCountB = vEntryErrorCountB + 1 //Error variable counts a few times before getting in the users face
vMessage = "The Short Form "
vMessage += (@xlu(@fn,ShortForm,"ProgramInformation!ShortForm","ShortForm"))
vMessage += " already exists for "
vMessage += @xlu(@fn,ShortForm,"ProgramInformation!ShortForm","Programname")
}
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!ShortForm","ShortForm")) and (not @error) and @IsNew and (vEntryErrorCountB > 3) then
{
@msgbox(vMessage,"Please enter a unique Short Form.","It must be be 2 to 6 characters long")
}
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!ShortForm","ShortForm")) and (not @error) and @IsNew then
{
@msg(ToUpper(vMessage))
@Play("Beep")
throwfocus(ThisElement)
}
// Check to see if the Short Form is the same as a base filename already in the database if this is a new record that has not been save yet
ThisElement = ToUpper(ThisElement) // Converts this field to upper case
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","BaseFilename")) and (not @error) and @IsNew then
{
vEntryErrorCountC = vEntryErrorCountC + 1 //Error variable counts a few times before getting in the users face
vMessage = "The Short Form "
vMessage += (@xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","ShortForm"))
vMessage += " already exists as a Base Filename for "
vMessage += @xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","Programname")
}
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","BaseFilename")) and (not @error) and @IsNew and (vEntryErrorCountC > 3) then
{
@msgbox(vMessage ,"It must not be a Base Filename for another program.","It must be be 2 to 6 characters long")
}
if (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","BaseFilename")) and (not @error) and @IsNew then
{
@msg(ToUpper(vMessage))
@Play("Beep")
throwfocus(ThisElement)
}
//If all is well and we are moving on set the error counter variables to 0
if (not @isblank(ThisElement)) and (not vLength = 1) and (not (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!ShortForm","ShortForm"))) and (not (ShortForm = @xlu(@fn,ShortForm,"ProgramInformation!BaseFilename","BaseFilename"))) and (not @error) and @isnew then
{
vEntryErrorCount = 0
vEntryErrorCountA = 0
vEntryErrorCountB = 0
vEntryErrorCountC = 0
Cnext
}
A note to Ray this is in the application I sent you earlier today. Just go into the Program Information form in add data mode and hit F10 to replicate.
Anyone got any ideas?
This does not seem to be normal behaviour. I went into the Customers database and added restrictions to a few fields and threw in the first section about the record not being blank but it refused to add a blank record.