Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfered value of DAO object is cutoff at 255 characters 1

Status
Not open for further replies.
Apr 9, 2002
102
US
I am trying to transfer the value of a DAO object and the value cuts off anything above 255 characters. Is there a way around this? Here is my current code to transfer the value:

xlApp.ActiveCell.Value = rsActivity![conactivitydesc].Value

I have the code working, but for some reason the value of rsActivity![conactivitydesc] stops at 255 characters. Is there a way to extend this? Thanks for your help.

Marrow

 
255 is the maximum length for a text variable. I'm not sure if you can use a memo type field in Excel. If you need to, can you parse it based on the length?

Good Luck!
 
The field is saved as a memo field and may or may not contain more than 255 characters. I need to pull the information from that cell and move it to excel. When I try to pull the value of the memo field with the code above I only get 255 characters. How can I get the full value of that memo field within the database? Thanks again.

Marrow
 
Sorry, I've not had to deal with this very often. I know there are 2 memo field processing methods called GetChunk and AppendChunk. I have never used them but here is some stuff from Access97 help. Hopefully someone else can help you. Good Luck!

Sub AppendChunkX()

Dim dbsNorthwind As Database
Dim rstEmployees As Recordset
Dim rstEmployees2 As Recordset
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
' Open two recordsets from the Employees table.
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", _
dbOpenDynaset)
Set rstEmployees2 = rstEmployees.Clone

' Add new record to first Recordset and copy the
' data from a record in the second Recordset.
With rstEmployees
.AddNew
!FirstName = rstEmployees2!FirstName
!LastName = rstEmployees2!LastName
CopyLargeField rstEmployees2!Photo, !Photo
.Update
'Delete new record because this is a demonstration
.Bookmark = .LastModified
.Delete
.Close
End With
rstEmployees2.Close
dbsNorthwind.Close
End Sub

Function CopyLargeField(fldSource As Field, _
fldDestination As Field)
Const conChunkSize = 32768 'Set size of chunk in bytes
Dim lngOffset As Long
Dim lngTotalSize As Long
Dim strChunk As String
'Copy the photo from one Recordset to the other in 32K
'chunks until the entire field is copied.
lngTotalSize = fldSource.FieldSize
Do While lngOffset < lngTotalSize
strChunk = fldSource.GetChunk(lngOffset, _
conChunkSize)
fldDestination.AppendChunk strChunk
lngOffset = lngOffset + conChunkSize
Loop
End Function
 
Hello SBendBuckeye,
Thanx for the above, didn't know AppendChunk/GetChunk existed, sorted out a problem I've been having. A * for U

Barbara
 
SBendBuckeye,

Thanks for your reply. I appreciate your help. Unfortunately, I could not get your solution to work with my problem. I did find another function that did allow me to export my memo fields greater than 255 characters into excel: DLookUp. If anyone would like to see how I used the function, just let me know. Thanks again for your help.

Marrow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top