View Single Post
  #4 (permalink)  
Old November 16th, 2006, 08:23 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Okay, here is the code that I used that transfer more than 256 characters from one memo field to another. This works, but I have to click it twice to get the text to show up in the form. I am not sure why that is.

I used a table called Table1, and TableID as an Autonumber PK, with Memo1 and Memo2 memo fields.


'---------Button On Click Event----------
Private Sub Command6_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim sID As Integer

sID = Me.TableID

sSQL = "SELECT * FROM Table1 WHERE TableID = " & sID

'Open Local Connection
Set cn = New ADODB.Connection
With cn
    .ConnectionString = CurrentProject.Connection
    .CursorLocation = adUseClient
End With

'Open Recordset
Set rs = New ADODB.Recordset
    rs.CursorType = adOpenDynamic
    rs.LockType = adLockOptimistic
    rs.Open sSQL, cn

'Move contents of one memo field to the other.
rs("Memo2") = rs("Memo1")

'Clean Up

'Try to get the Memo2 field on the form to show current state.

End Sub
'----------End Code------------

Reply With Quote