2013-09-24 67 views
1

錯誤提示「字段太小,無法接受您嘗試添加的數據量,請嘗試插入或粘貼更少的數據。」MS Access 2003上出現錯誤(3163)

數據庫應該從傳遞給它的Excel工作表中提取信息,並將信息導入到文本字段的記錄集中。但是,文本字段的下一行已被限制爲50個字符。如何更改文本字段的最大大小?感謝您的幫助

這只是部分的代碼,我試圖做出了較大的文本字段是「Idea_#」,這是我貼

子Read_Recommendations代碼的最後一行( ) 對錯誤轉到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)) 

........

回答

2

在Access中,在Design View中打開tbl_recomendations。這聽起來像字段大小屬性Idea_#設置爲50,您可以更改多達255

如果需要超過255個字符存儲在Idea_#,其數據類型文本改變到備註

+0

這可能看起來像一個愚蠢的問題,但我該如何打開設計視圖? – user2812680

+0

沒關係,我明白了,非常感謝你的幫助! – user2812680