这是我的一段程序,可是就是不知道到底那里错了.它提示的错误是:没有标识ADOTable_basic和ADOTable_exp  我是在Form_main里的建的ADOTable_basic这个是主表,ADOTable_exp这个是从表.请高手看看到底是那里错了.万分感谢!procedure TForm_exp.Button_expClick(Sender: TObject);
var
count_exp2:integer;//用于记录经历表中的记录条数
begin
     begin
        Form_exp.Hide;
     end;
     begin
     ADOTable_exp2.Active:=True;
     count_exp2:=ADOTable_exp2.RecordCount;//获得经历表中的记录条数
     ADOTable_exp2.Append;
     ADOTable_exp2.FieldByName('序号').AsString:=IntToStr(count_exp2+1);
     ADOTable_exp2.FieldByName('职工号').AsString:=ADOTable_basic.FieldValues['职工号'];
     ADOTable_exp2.FieldByName('起始时间').AsDateTime:=MonthCalendar_start.Date;
     ADOTable_exp2.FieldByName('终止时间').AsDateTime:=MonthCalendar_end.Date;
     ADOTable_exp2.FieldByName('所在部门').AsString:=Edit_dept.Text;
     ADOTable_exp2.FieldByName('职务').AsString:=Edit_res.Text;
     ADOTable_exp2.FieldByName('行政级别').AsString:=Edit_lev.Text;
     ADOTable_exp2.FieldByName('奖励次数').AsString:=Edit_JL.Text;
     ADOTable_exp2.FieldByName('惩罚次数').AsString:=Edit_CF.Text;     ADOTable_exp2.Post;
     ADOTable_exp2.Active:=False;
     ADOTable_exp.Refresh;
     end;end;

解决方案 »

  1.   

    1)你要证实表已经存在2)你再查一下你的ADOTable_basic和ADOTable_exp  表的各属性是不是设对了你上面的代码应该没有错
      

  2.   

    把ADOTable_basic和ADOTable_exp改為﹕Form_main.ADOTable_basic和Form_main.ADOTable_exp,因為你調用的是Form_main的內容。
      

  3.   

    ADOTable_exp2.FieldByName('起始时间').AsDate:=MonthCalendar_start.Date;
    ADOTable_exp2.FieldByName('终止时间').AsDate:=MonthCalendar_end.Date;
    ADOTable_exp2.Active:=False;//你看看这一条是不是没有必要
    纪录条数不准确(每当数据删除更新的时候,会引起异常),你或者使用最大值,或者使用自增长字段
      

  4.   

    小别:
    我觉得你说的对,按你说的改了过来。可是程序运行后告诉我没有标识Form_main还是有错误呀,请问这是为什么呢??
      

  5.   

    你这里是Form_exp吧,在uses里添加Form_main的单元名称。
      

  6.   

    firetoucher(风焱) :在uses里我已经添加了Form_main的单元名称。好象不是这里除了问题。还有别的原因吗?
      

  7.   

    在uses里添加Form_main的单元名称(不是Form_main窗體名稱)。
      

  8.   

    小别:这个我知道呀,我写程序之前就加了Form_main所在的单元unit1firetoucher(风焱) :错误信息Undeclared identifier:"Form_main"
      

  9.   

    ADOTable_exp.Refresh;
    ====>ADOTable_exp.updaterecord;
      

  10.   

    jtx1226(幻若雪晴) :不是这里的错误
    jtx1226(幻若雪晴) :光标定在Form_main.ADOTable_basic.FieldValues['职工号'];的Form_main后
    outer2000(天外流星) :你说的是在uses里自动创建的吗?
      

  11.   

    1 核实名称
    2 Form_main是全局变量函数你自己动态产生的?
      

  12.   

    真的是谢谢大家了,这个问题我已经搞定了.我又重新核实了一下我所有的名称.是那里出了问题,真是麻烦大家了.嘻嘻~~~~~但是现在运行的时候又出现问题了,系统提示的错误信息是Progect Progectexercise.exe raised exception class EOLeException with message'[Microsoft][ODBE Microsoft Access Driver]The changes you requested to the table were not successful because they would create duplicate values in the index,primary key,or relationship.Change the data in the field of fields that contain duplicate data,remove the index,or redefine the index to permit duplicate entries and try again'.Proccess stopped.Use Step of Run to continue.我想知道他是不是在说我的索引index的属性没有设置应该为primary key.
    麻烦大家了!