access数据库中存在3个表有效数据表A,全部数据表B,无效数据表C ,在修改了有效数据表A后,为了更新B和C,操作如下:1.清空B,C;
2.以for i=1 to n 的方式顺序判断A中是否有符合和i相关的数据(说明:A和C中含有与i无关的数据)
3.没有符合条件的情况:则插入到C中,同时也插入B中
4.有符合条件的情况:则插入到B中完成操作后,分别显示A,B,C是报错:3167:“record is deleted”不知为何?是因为数据量大的原因吗(两三万条)?

解决方案 »

  1.   

    刚到msdn上查了一下:http://support.microsoft.com/kb/208799/en-us/贴出来一块研究一下:
    SYMPTOMS
    When you add a record to an SQL table using Visual Basic for Applications, if the table's unique index field has a default value, and you do not assign a value to that field, the new record appears deleted until you reopen the SQL table. If you try to obtain a value from the new record, you receive the following error message: Run-time error '3167'
    Record is deleted. 
    RESOLUTION
    To resolve this behavior, when you open the SQL table by using Visual Basic code, include the dbSeeChanges option, as in the following example: Set rs = db.OpenRecordset("TestTable", dbOpenDynaset, dbSeeChanges)

    The dbSeeChanges option ensures that any newly added records that contain a default value in the unique index field are available in the current recordset. 
      

  2.   

    关闭记录集试过了,不行;msdn上的方法也试过了,也不行。重启系统后数据正常,是删除和插入后所要得的数据。到底是什么原因啊?曾怀疑过是数据量的问题,也怀疑是操作数据和显示数据不在同一窗体的问题,我都编制小程序模拟过了,可以正常显示,为何在原系统中总报错呢?