提示?(40分)

  • 主题发起人 主题发起人 ydn81
  • 开始时间 开始时间
Y

ydn81

Unregistered / Unconfirmed
GUEST, unregistred user!
窗体上放置了三个按钮,增加、前一条、后一条。当我给表APPEND一条记录时,按前一条按
钮时,想跳出提示信息:‘是否保存记录?OK,CANCEL,’当OK时保存,CANCEL,不保存。
但是不是APPEND的记录按‘前一条’按钮,不想出现提示信息,应怎样写代码?
 
能否将最后一行话写得明白点
 
在append onclick事件里写
if Application.Messagebox(‘是否保存记录?','系统提示:',MB_OKCANCEL+MB_ICONQUESTION)=IDOK then
do 加入记录......
else Exit;
后一句看不清了
 
我的意思是当我增加了一条记录,按‘前一条’按钮时,出现提示信息,如果没有增加记录,
按‘前一条’按钮,不出现提示信息.
 
在 Table 的 BeforePost 事件中加入 messagebox.
if ok then
...
else
table1.cancel
 
试试
if (Table1.modified) and (DBEDIT1.text<>'')then
begin

end;
 
应该在 Table 的 BeforePost 事件中处理
if Application.Messagebox('是否保存','提示',Mb_OkCancel) = IdCancel then
begin
DataSet.Cancel;
abort
end;
 
若新增时提示,修改时不需要提示。在table的BeforeScroll事件中处理。

if ([dsInsert] in table.state) and
(Application.Messagebox('是否保存','提示',Mb_OkCancel) = IdCancel) then
begin
Table.Cancel;
abort
end;
 
我同意michael.ma和sundart方法,因为update 和append后
当前记录改变时都会触发BeforePost事件。
 
case table1.state of
dsedit:showmessage('edit');
dsinsert:showmessage('insert');
dsbrowse:showmessage('browse');
end;
 
后退
顶部