代码如下, 是一个登录界面!  我觉得and应该换成or,尾和头能共存吗?不懂!
  procedure TdlForm.Label4Click(Sender: TObject);
begin
if data1.stateb.eof and data1.stateb.bof then
begin
  if DirectoryExists('c:\xjb\dbf\'+trim(rqcombobox.text)) then
  begin
    sjrq:=trim(rqcombobox.text);
    data1.b.active:=false;
    data1.b.databasename:='c:\xjb\dbf\'+sjrq;
    dlform.Visible:=false;
    mainform.showmodal;
  end
  else
  showmessage('该月数据不存在,请检查!');
end
else
begin
  if trim(rqcombobox.text)='' then
    showmessage('请选择数据日期')
  else
  begin
  if DirectoryExists('c:\xjb\dbf\'+trim(rqcombobox.text)) then
  begin
    sjrq:=trim(rqcombobox.text);
    data1.b.active:=false;
    data1.b.databasename:='c:\xjb\dbf\'+sjrq;
    dlform.Visible:=false;
    mainform.showmodal;
  end
  else
  showmessage('该月数据不存在,请检查!');
  end
end;end;

解决方案 »

  1.   

    没问题。
    如果bof和eof同时为真说明记录条数为0
      

  2.   

    if data1.stateb.eof and data1.stateb.bof then
    既是bof也是eof,表示表中无符合条件的记录
      

  3.   

    还有trim()函数是什么意思?看帮助有些不懂!好象是拖动空间什么的?
      

  4.   

    这一句我也不懂,真是菜鸟呀!你们当初是怎么学的?加号data1.b.databasename:='c:\xjb\dbf\'+sjrq;
      

  5.   

    表明没有符合条件的记录!

    if data1.stateb.eof then
    begin
    end;
    效果一样trim用作去掉字符串两边的空格