Results 1 to 2 of 2

Thread: [RESOLVED] #VALUE! message in Excel cell

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    44

    Resolved [RESOLVED] #VALUE! message in Excel cell

    I am having a strange problem with a routine in Access that is writing a recordset out to a spreadsheet. Most of my recordset is exporting fine, but I have two particular records whose text fields are not been written to the cell properly and when you open the spreadsheet you see the #VALUE! error in the cell.

    Code fragment follows:
    VB Code:
    1. debug.print rstGenericImport.RecordCount
    2. 'ok at this point I can verify that all my records have been included...
    3.  
    4. While Not rstGenericImport.EOF
    5.                 With excelWS.Cells(rowCounter, 5)
    6.                    Debug.Print rstGenericImport!test_script
    7. 'stepping thru the code I can hold my mouse over the above line and see 'that my text value is ready to be written into the spreadsheet cell...
    8.  
    9.              'even though I can see it at the following line in the spreadsheet
    10.              'it will have the #VALUE! error in the cell
    11.  
    12.                     .Value = rstGenericImport!test_script
    13.                    
    14.                     .Font.Size = 8
    15.                     .Font.Bold = False
    16.                     .Font.Name = "Verdana"
    17.                     .Font.Italic = False
    18.                     .WrapText = True
    19.                     .ShrinkToFit = True
    20.                     .HorizontalAlignment = xlLeft
    21.                     .VerticalAlignment = xlTop
    22.                 End With
    23.  
    24. '...rest of the loop...

    The field is of type MEMO by the way. As I mentioned before there are only two records where this is occurring, the rest write the values into the cell correctly.

    If anybody has some ideas I would be very appreciative as its got me beat for the moment. Thanks

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    44

    Re: [RESOLVED] #VALUE! message in Excel cell

    Ok, I solved this issue by assigning the text value from the recordset to a string variable, and then using that to write to the spreadsheet cell. However, I still don't know why it was not working before, and why it was only a couple of records in my database, but... <<shrugs shoulders dismissively>>

Posting Permissions

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



Click Here to Expand Forum to Full Width