Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    182

    Unanswered: The field is too small to accept the amount of data you attempted to add

    I am getting the following error when I try to use the code below to populate a textbox based on the selection of a combo.The field is nvarchar 100 so it should be large enough.??????

    Error: The field is too small to accept the amount of data you attempted to add

    Me!txtPartName = "SELECT tblPartNumber.[Part_name]" & _
    "FROM dbo.tblPartNumber, dbo.tblcustpart " & _
    "WHERE dbo.tblPartNumber.Part_no = dbo.tblCustPart.Part_no " & _
    "AND dbo.tblPartNumber.Part_Name = dbo.tblCustPart.Part_name " & _
    "AND dbo.tblPartNumber.Part_no = '" & Me!cboPart & _
    "'"

    Me.txtPartName.Requery

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    Cut and paste your select statement into a test query to see how many records you get back. If more than 1 your statement is improper.

  3. #3
    Join Date
    Apr 2004
    Posts
    182
    Looks like this is the problem. When I use DISTINCT in the Qeury it works but not when I use it in the code ??
    Last edited by livvie; 05-14-04 at 05:33.

  4. #4
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    Right! You get more than one row (result) from your query without the distinct key word. So, you can not associate a bunch of rows to a single text field as is combo/txt box. It's not the length of text but the number of rows which is the problem or why the error msg. You need to rethink what you are after, or add distinct to your select statement or Top 1 to make it work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •