I hope that someone can help me with this problem.
I need to allow only characters in input:
Example I have procedure to add records to my database

procedure AddRec( var fff:Myfiletype; FileOpen: boolean);
var rec:myrec; tmp:MyFileType;
begin
    assign(tmp,'data.tmp');
    reset(fff); rewrite(tmp);
    seek(fff,0);
    while not eof(fff) do
    begin
    read(fff,rec); write(tmp,rec);
    end;
    {$I-}
    write('Write 1st. city : '); readln(rec.P1);
    {$I+}
    if (ioresult<>0) then begin myfileerr:=7; ferror; end
    else
    begin
    write(tmp,rec);
    rewrite(fff); reset(tmp); seek(tmp,0);
    while not eof(tmp) do
    begin
    read(tmp,rec); write(fff,rec);
    end;
    end;
    close(tmp); reset(fff); seek(fff,0);
end;

So... I need to allow only characters from a to z to input.
I would be grafetful if someone could help me with this problem

compare each character to the ASCII a..z or A..Z range of characters. if character outside those ranges, message user that the character is bad, then allow user to re-enter.

Can you do something like this?

Procedure TfrmRasCorrections.dfFirstNameKeyPress(Sender: TObject;
Var Key: Char);
Begin
//The #8 allows backspace to be used.
//The #32 is for space bar to be used.
//'A'..'Z' allows uppercase. 'a'..'z' allows lowercase letters.
If not (key in ) then
Begin
Key:= #0;
Beep; //I'm using a beep but this is where you could use your error message.
End;
End;

This article has been dead for over six months. Start a new discussion instead.