Subject | Re: [IBO] Access Violation, Error in FPXSQLVAR.aliasname_length |
---|---|
Author | Mihai Chezan |
Post date | 2004-07-22T09:58:45Z |
--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...>
I've experienced somewhat the same problem (with the 'cannot focus a
set. You would have to do that anyway because is just better to show
to the user a friendly error message that the default one.
So the code goes on BeforePost (at dataset level):
procedure TFormXXX.IB_QueryXXXBeforePost(IB_Dataset: TIB_Dataset);
var
i: Integer;
begin
with IB_Dataset do
begin
for i:=0 to FieldCount-1 do
begin
if (Fields[i].IsNull and not Fields[i].IsNullable) then
begin
ShowMessageFmt('The field "%s" cannot be empty!', [Fields[i].
DisplayName]);
Abort;
end;
end;
end;
end;
Instead of aborting after the first field that is required and not
set, you could build the list with all fields that are required and
not set and then present a more complete error message.
Anyway, using this has solved the other problem for me.
> wrote:Hi,
>
> I have a TIB_Query called WorkDocket, which I edit and insert to
> with a modal form. There are a couple of required fields. If the
> fields are not filled in, instead of getting an error message I get
> .....
> from time to time if I step through it I get 'cannot focus a
> disabled or invisible window'. I am aborting the form close if there
> is an error, so I dont know why this would happen.
I've experienced somewhat the same problem (with the 'cannot focus a
> disabled or invisible window' when some required fields are not set)My solution was to prevent the posting if some required fields are not
set. You would have to do that anyway because is just better to show
to the user a friendly error message that the default one.
So the code goes on BeforePost (at dataset level):
procedure TFormXXX.IB_QueryXXXBeforePost(IB_Dataset: TIB_Dataset);
var
i: Integer;
begin
with IB_Dataset do
begin
for i:=0 to FieldCount-1 do
begin
if (Fields[i].IsNull and not Fields[i].IsNullable) then
begin
ShowMessageFmt('The field "%s" cannot be empty!', [Fields[i].
DisplayName]);
Abort;
end;
end;
end;
end;
Instead of aborting after the first field that is required and not
set, you could build the list with all fields that are required and
not set and then present a more complete error message.
Anyway, using this has solved the other problem for me.