|
近期得到一Access档案,其中一个功能是读取在线数据库备份至本地,起初都 OK,但是当本地数据库(Access)记录多到一定程度的时候就会发生错误,执行Msg = "No table found with this name - " & tblNameQualev & " !"。
是不是读取超时?该如何改进?
Private Sub CheckQualevData()
On Error GoTo No_Table
Set rstData = dbsCurrent.OpenRecordset("SELECT * FROM " & tblNameQualev & _
" WHERE INTERNAL_KEY > 0 ORDER BY IDENTITY_KEY")
X = rstData.RecordCount
If X > 0 Then
rstData.MoveLast
lblUpdateQualev.Caption = rstData.Fields("CC_SEQU_ID3") & " - " & rstData.Fields("CC_DATI_CAST")
UpdateQualev.Enabled = True
Else
' empty table
lblUpdateQualev.Caption = " no Data - empty Table "
End If
rstData.Close
Exit Sub
No_Table:
Msg = "No table found with this name - " & tblNameQualev & " !" ' Define message.
Style = vbOK
Title = "Info" ' Define title.
Response = MsgBox(Msg, Style, Title)
UpdateQualev.Enabled = False
End Sub
|
|