delphi窗体调用过程中出现access violation,请高手帮忙
procedure TForm1.Button1Click(Sender: TObject);var user,temp:string;
begin
user:=Edit1.Text;
temp:='';
DataModule1.ADOQuery1.Close;
DataModule1.ADOQuery1.SQL.Clear ;
DataModule1.ADOQuery1.SQL.Text:=('select 门诊编号 from 门诊挂号表 where 门诊编号='''+user+'''');
DataModule1.ADOQuery1.Open;
temp:=DataModule1.ADOQuery1.FieldByName('门诊编号').AsString ;
if temp<>''then
Form5.ShowModal
else
showmessage('输入错误,请重新输入!');
end;