我在关闭MDI窗体时出现了这样的错误提示"Access violation at address 00000014.Read of address 00000014.";
而且程序无法释放,那位能帮忙解决一下!这是登录窗体的代码(普通窗体):
procedure TForm_login.labClick(Sender: TObject);
var sqlstr:string;
begin
sqlstr:='select yg_mm,yg_yhbh,yg_ygqx from yg  where yg_yhbh='''+edit1.text+'''';
ADOQuery_LOGIN.Close;
ADOQuery_LOGIN.SQL.Clear;
ADOQuery_LOGIN.SQL.Add(sqlstr);
ADOQuery_LOGIN.Open;
ygqx:=ADOQuery_LOGIN.FieldByName('yg_ygqx').AsString;
if ADOQuery_LOGIN.FieldByName('yg_yhbh').AsString='' then
  begin
    ShowMessage('对不起,用户名不存在!');
    exit;
  end;
  if ADOQuery_LOGIN.FieldByName('yg_mm').AsString=edit2.Text then
  begin
      application.CreateForm(TForm_main,Form_main);//验证成功的话进入FORM_MAIN(MDI窗体)
      Form_main.ShowModal;
  end
  else ShowMessage('对不起!密码有误!')
end;下面是FROM_MAIN(MDI)的部份代码:
procedure TForm_main.FormCreate(Sender: TObject);
var m,qxstr:string;
    count,n,i,k,e:integer;
begin
qxstr:=ygqx; //得到对应的登录者的权限字符串从FROM_LOGIN中得到
count:=ComponentCount-2;//共有多少个控件项
k:=0;
for i:=0 to count do
  begin
  if Components[i].Name='MainMenu1' then
    n:=i;                    //得到菜单项的开始值
  if components[i].Name='N18' then
    e:=i;                    //得到菜单项结束
  end;
 for i:=n+1 to e-n do  //从菜单项开始到菜单项结束
begin
  m:=LeftStr(qxstr,1);//得到权限字符串的第一个权限值
  //ShowMessage(m+'是'+inttostr(i));
  if m='1' then
    TMenuItem(Components[i]).Visible:=true  //令有操作权限的菜单可视
  else
    TMenuItem(Components[i]).Visible:=false; //否则为不可视
  qxstr:=rightstr(qxstr,e-n-i);//把已提取的权限值去除
end;
Form_login.Free;
end;
就这样子,每次进入FROM_MAIN后,想要关闭它,都会提示"violation at address 00000014.Read of address 00000014",而且无法释放掉该进程!
各位大虾帮帮忙!谢谢!