# Re: 如何得知.mdb资料库内某资料表存不存在....

Posted by Roger on February 11, 1999 at 13:41:52:

In Reply to: 如何得知.mdb资料库内某资料表存不存在.... posted by ADAN on February 11, 1999 at 12:42:26:

: 一个mdb资料库内有很多资料表,程式每次增修资料,如无此资料表将会新增
: 这是否程式每次增修资料时,都要用on error....去侦测是否要建新资料表呢
: 例:
: On Error GoTo ......
: Set rs = DB.OpenRecordset(test1, dbOpenDynaset)
: 有否更好的方式,就像open filepath for append as #1那样自动新建档案

还是要要自已一个一个去判断存不存在啊.
str_Table = "MyTable"
TableExist = False
For i = 0 To MyDatabase.TableDefs.count - 1
If (MyDatabase.TableDefs(i).Name = str_Table) Then
TableExist = True
End If
Next i

Follow Ups: