0G6rUYek.zip
(9.24 KB, 下载次数: 141)
按书上所说先引用microsoft actviex data object 2.8 library & microsoft ado ext.2.8 for ddl and security 然后在标准模块中输入如下代码: Sub SETDATABASE() Dim cnn As New ADOX.Catalog Dim mypath As String Dim mytable As String mypath = ThisWorkbook.Path & "\学校管理.mdb" mytable = "学生档案" If Dir(mypath) <> "" Then Kill mypath cnn.Create "provider=microsoft.jet.oledb.4.0;data source=" & mypath cnn.ActiveConnection.Execute "Create Table" & mytable _ & "(学生编号 int,姓名 text(10),住址 text(255)," _ & "家庭电话 text(15),特长 text(255))" Set cnn = Nothing MsgBox "数据库创建成功!"'这里我省略了一些! End Sub 但当我运行此代码时提示:"Syntax error in CREATE TABLE statement" 弄了半天没弄明白,故特请教各位此问题是出在哪里? 谢谢大家帮忙看看?
|