在access中text字段只允许255个字符,而memo型可允许64000。但是,在下例语句中,vb却报错,说字段类型不对!请各位帮忙参详一下!!public sub CreateTable()Dim TableName As String
Dim strSql2 As String
Dim dbconnection As New ADODB.Connection
GetTableName:
TableName = InputBox("请输入表名称(尽量使用英文字母):", "导出提示")
dbpath = App.Path & "/customer.mdb"
If dbconnection.State = adStateClosed Then
dbconnection.Open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath
End If
If TableExists(dbconnection, TableName) Then
If MsgBox("该表已存在,请输入新的表名!", vbYesNo, "出错提示") Then
GoTo GetTableName
Else
dbconnection.Close
Exit Sub
End If
End If
strSql = "create table " & TableName & " ( " & vbCrLf & _
"customname text(200)," & vbCrLf & _
"customaddress text(200), " & vbCrLf & _
"postnum text(10), " & vbCrLf & _
"linkman text(20), " & vbCrLf & _
"tel text(50), " & vbCrLf & _
"fax text(50), " & vbCrLf & _
"customtype text(20), " & vbCrLf & _
"explain text(255) )"
dbconnection.Execute strSqlend sub
Dim strSql2 As String
Dim dbconnection As New ADODB.Connection
GetTableName:
TableName = InputBox("请输入表名称(尽量使用英文字母):", "导出提示")
dbpath = App.Path & "/customer.mdb"
If dbconnection.State = adStateClosed Then
dbconnection.Open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath
End If
If TableExists(dbconnection, TableName) Then
If MsgBox("该表已存在,请输入新的表名!", vbYesNo, "出错提示") Then
GoTo GetTableName
Else
dbconnection.Close
Exit Sub
End If
End If
strSql = "create table " & TableName & " ( " & vbCrLf & _
"customname text(200)," & vbCrLf & _
"customaddress text(200), " & vbCrLf & _
"postnum text(10), " & vbCrLf & _
"linkman text(20), " & vbCrLf & _
"tel text(50), " & vbCrLf & _
"fax text(50), " & vbCrLf & _
"customtype text(20), " & vbCrLf & _
"explain text(255) )"
dbconnection.Execute strSqlend sub
解决方案 »
- 如何处理多个数据库的系统
- 怎样将 Access数据库的同一表中 指定纪录的指定字段 复制到其他纪录的相同字段并清除原来的字段值
- vb怎么实现和服务器端access数据库相连?.....急!
- 我现在要用winsock控件做一个程序?
- 各位精通图形编程的同仁们,请教TIF文件的通用打开方式(只有60分,在下问题不少,分又不多,略有难度)
- 设置ListView的ColumnHeaderIcons后,界面的美观问题
- 各位好!我想请教一下有关托盘程序能否进行信息提示功能!
- 急问大家怎么控制打印啊
- MSHFlexGrid一问
- 倒,遇到小问题
- 请问如何固定窗体的大小?
- 在线等待-100分(一个TTS语音的问题--我的困惑 TextToSpeech)
to victorycyz:我是将整个存储过程放在变量strsql中的,所以要用 vbcrlf
"customname text(200)," & vbCrLf & _
"customaddress text(200), " & vbCrLf & _
"postnum text(10), " & vbCrLf & _
"linkman text(20), " & vbCrLf & _
"tel text(50), " & vbCrLf & _
"fax text(50), " & vbCrLf & _
"customtype text(20), " & vbCrLf & _
"explain memo )"
dbconnection.Execute strSql