Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 14th, 2006, 07: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

Reply With Quote
  #2 (permalink)  
Old November 14th, 2006, 12: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
Reply With Quote
  #3 (permalink)  
Old November 16th, 2006, 03: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

Reply With Quote
  #4 (permalink)  
Old November 16th, 2006, 07: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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 01:53 PM
need to be truncated PatrickH SQL Server ASP 2 April 15th, 2004 10:48 AM



All times are GMT -4. The time now is 02:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.