one:
on error goto xx
   sql="create table users (id char(10),name char(20))"
    conn.execute(sql)
    exit function
xx:
 

解决方案 »

  1.   

    on error goto xx
       sql="create table users (id char(10),name char(20))"
        conn.execute(sql)
        exit function
    xx:
        sql="delete users"
        conn.execute(sql)
        sql="create table users (id char(10),name char(20))"
        conn.execute(sql)
      

  2.   

    用sql语句:
     select * from msysobjects where type=1 and name='" & 你的表名 &"'"
    来判断。
      

  3.   

    用sql语句:
     select * from msysobjects where type=1 and name='" & 你的表名 &"'"
    来判断。
      

  4.   

    你在sqlserver上打开一个表,然后生成
    这个sql Script,你就知道怎么做了!
      

  5.   

    '察看是否存在xxx表。msysobjects :系统表。type=1 :察看表,name:表名
    set adorec=adocon.execute("select * from msysobjects where type=1 and name='" & xxx &"'")
    if adorec.eof and gadorec.bof then 
    '不存在
    else
    '存在。
    endif
      

  6.   

    Public conn As New ADODB.Connection
    Public reco As New ADODB.Recordset
    dim sql as string
    set reco =conn.execute("select * from msysobjects where type=1 and name='" & 110 &"'")
    if reco.eof and reco.bof then 
    '不存在
         sql = "create Table 110 (id char(3),id1 char(5))"
         conn.Execute (sql)'
    else
    '存在。
     msgbox "已经存在!"
    endif
      

  7.   

    Option Explicit
    Public Conn As New ADODB.ConnectionPrivate Sub Command1_Click()
    Dim x As Database
    Dim isFind As Boolean
    Dim i As Integer
    Dim sql As String
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb;Persist Security Info=True"
    Set x = OpenDatabase("C:\db1.mdb")
    isFind = False
    For i = 0 To x.TableDefs.Count - 1
        If x.TableDefs(i).Name = "110" Then
            isFind = True
        End If
    Next
    If isFind = False Then
        sql = "create Table 110 (id char(3),id1 char(5))"
         Conn.Execute (sql) '
    Else
     MsgBox "已经存在!"
    End If
    x.Close
    End Sub