在 MS Access 2003 上出现错误 (3163)

Posted

技术标签:

【中文标题】在 MS Access 2003 上出现错误 (3163)【英文标题】:Getting an error (3163) on MS Access 2003 【发布时间】:2013-09-30 06:15:46 【问题描述】:

错误提示“该字段太小,无法接受您尝试添加的数据量。请尝试插入或粘贴更少的数据。”

数据库应该从传递给它的 Excel 工作表中提取信息,并将信息导入文本字段的记录集中。但是,文本字段(位于该行的某处)已被限制为 50 个字符。如何更改文本字段的最大大小?感谢您的帮助

这只是代码的一部分,我要放大的文本字段是“Idea_#”,这是我发布的代码的最后一行

Sub Read_Recommendations() On Error GoTo error_code 将 FD 调暗为 Office.FileDialog 将 xlapp 调暗为 Excel.Application 将 xlsheet 调暗为 Excel.Worksheet 将 xlbook 调暗为 Excel.Workbook

Dim db As Database
Dim rs As Recordset
Dim sql As String

Dim WP As String
Dim row As Integer

Dim File As String
Set db = CurrentDb

Set FD = Application.FileDialog(msoFileDialogOpen)
If FD.Show = True Then
    File = FD.SelectedItems(1)
    Set xlapp = CreateObject("Excel.Application")
    Set xlbook = GetObject(File)
    Set xlsheet = xlbook.Worksheets("Recommendation Approval Form")

    Dim protection As Boolean
    With xlsheet

        'support unprotected worksheets
        protection = xlsheet.ProtectContents
        If protection Then xlsheet.Unprotect "veproject"

        WP = .Range("WP_Number")
        ' Check that active WP and the WP of the uploading form is the same
        ' If WPs are different, awares users and prompts user whether or not to continue
        Dim DifferentProject As String
        If Not get_WP = WP Then
            DifferentProject = MsgBox("You are uploading to the project with WP number: " & WP & " which is not the active project. Do you wish to continue?", vbYesNo)
            If DifferentProject = 7 Then Exit Sub
        End If

        ' Check that WP is correct by checking if it exists in the Record Information table

        ' delete the existing recomendations, we want to keep the most recent recomendations
        ' perhaps change this to a dialog in the future
        sql = "DELETE * from tbl_recomendations WHERE WP_Number = '" & WP & "'"

        db.Execute (sql)
        row = 8

        Set rs = db.OpenRecordset("tbl_recomendations")
        Do While .Range("D" & row) <> ""
            rs.AddNew
            rs("WP_Number") = WP
            rs("Idea_#") = (.Range("C" & row))

........

【问题讨论】:

【参考方案1】:

在 Access 中,在设计视图中打开 tbl_recomendations。听起来Idea_#Field Size 属性设置为 50。您最多可以将其更改为 255。

如果您需要在Idea_# 中存储超过 255 个字符,请将其 Data TypeText 更改为 Memo

【讨论】:

这似乎是一个愚蠢的问题,但我如何打开设计视图?

以上是关于在 MS Access 2003 上出现错误 (3163)的主要内容,如果未能解决你的问题,请参考以下文章

MS Access 2003 - 创建 MDE 文件失败:错误 VBA 已损坏?

MS Access 2003 - Access 表单上的嵌入式 Excel 电子表格

ms access 2003 .mdb 无法查看表

关于 MS Access 2003 和 VBA 编程

抑制 MS Access Excel 警告/错误

ms access 2003 - 表单上的文本框:不跳转到任何文本框