0
我想創建一個新的表,在vba上有幾個字段用於Access 2000.我能夠創建表和字段數據類型的字段是文本但我需要它是數字。當我將數據類型從文本更改爲數字時,它會給我提供錯誤數據類型轉換錯誤。任何幫助,將不勝感激。謝謝在vba Access 2000中創建新表和字段時獲取錯誤數據類型轉換錯誤
Public Sub CreateNewDB()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
'Initialize the Contractor table
Set db = CurrentDb()
Set tdf = db.CreateTableDef("new test table")
'Specify the fields
With tdf
'Create Sequence No Fied
' Set fld = .CreateField("Sequence No", dbText, 10) ' This works
Set fld = .CreateField("Sequence No", dbNumber, Long INteger) ' this gives me an error
.Fields.Append fld
End With
'save the table
db.TableDefs.Append tdf
Set fld = Nothing
Set tdf = Nothing
End Sub
感謝幫助貝絲。你能幫我解決一個問題嗎?如何設置主鍵並將索引設置爲是(無重複) – CodeEngine
非常感謝您的幫助!你太棒了 ! – CodeEngine