Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 14th, 2006, 08:54 AM
Authorized User
 
Join Date: Dec 2003
Location: Brussels, , Belgium.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Truncated field when copying

Hello,
I have a form based on a table containing 2 memo fields :
fld_base_text and fld_edit_text.
I have created a button that copies the text from field to field.
The command is the following :
fld_edit_text = fld_base_text
The problem is that if the field content is too long, the copied text is truncated.
Oddly enough, if I copy/paste with the mouse or the shortcut keys, then there is no problem.
Any solution or suggestion ?
Thanks

  #2 (permalink)  
Old November 14th, 2006, 01:16 PM
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

I think your code is only taking the first 256 characters of the memo field. I think you may have to do this in a DAO recordset.

Why are you using two fields with the same data in the same table?

mmcdonal
  #3 (permalink)  
Old November 16th, 2006, 04:13 AM
Authorized User
 
Join Date: Dec 2003
Location: Brussels, , Belgium.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you have an idea of the coding here?
If I am using twice the same field, it is for the following reason :
fld_base_text is the original text that CANNOT be modified
fld_edit_text is a copy of the original version that can be completely modified (depending on the case)
Thanks,
Sven

  #4 (permalink)  
Old November 16th, 2006, 08:23 AM
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Querying against truncated dates John Pennington SQL Server 2000 3 October 16th, 2006 11:55 PM
Truncated Memo field on Report echovue Access 5 August 16th, 2006 08:52 AM
Long Name truncated with SendMail echovue Excel VBA 0 May 12th, 2005 03:05 PM
Truncated Form Values. conscience Pro PHP 1 December 27th, 2004 02:53 PM
need to be truncated PatrickH SQL Server ASP 2 April 15th, 2004 10:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.