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
Default

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.


HTH

'---------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
    .Open
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")
rs.Update

'Clean Up
rs.Close
cn.Close

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

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


mmcdonal
Reply With Quote