【问题标题】:Getting an error (3163) on MS Access 2003在 MS Access 2003 上出现错误 (3163)
【发布时间】: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))

........

【问题讨论】:

    标签: database ms-access runtime-error


    【解决方案1】:

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

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

    【讨论】:

    • 这似乎是一个愚蠢的问题,但我如何打开设计视图?
    猜你喜欢
    • 1970-01-01
    • 2012-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多