Memo Field is Trimming Blank space

fishonland

Registered User.
Local time
Today, 19:37
Joined
May 26, 2003
Messages
15
I am simply trying to allow a memo field to allow the addition of blank lines or spaces at the end of the memo.

Currently I add a couple of spaces onto the end of the memo, when I leave the field and re-enter the blanks are automatically removed.

Anyone know how to turn this off?

Thanks in advance
 
Hi. I'm not sure there is "a way to turn it off" but I think of a way to force blank lines/and/or spaces using a bit of code in the - on focus/lost focus events.

Can you give me a little more idea of the use that the blank line/spaces will serve?

Do you want this to occur every time you exit/return to the memo field or is it dependant on some criteria?


Sprocket
 
Here is what I am trying to do.

The Memo field is used as an additional information field for orders. I have a drop down box based on a table with some default information to be inserted into the memo field. (To save the users from having to type out the same information time and time again). The information is then entered into the memo box where the cursor was left at. This form works great when you run the command in the middle of the memo, however the error occurs when you enter a couple of spaces or lines on the end of the memo filed then select the text you want from the drop down box and click the button.

Steps to recreate the error.

Enter Information into the Memo field.

Add a couple of spaces (or Lines) onto the end of the description.

Select the drop down box and pick an option (Memo Field looses focus and removes all trailing spaces)

Click on the "add to memo" button to add the selected text to the memo field.

Hope this clarifys the situation.

Thanks
 
OK.... I'm not sure why your system is stripping out trailing spaces because mine doesn't and I have to put a bit of code into the after update event to strip trailing spaces out. The following is a stripped down piece of code that I use to put the date into a memo field ecah time I enter to add to the notes already there.

Therefore you might find that you can use the same method to insert a blank line into the memo field just before you insert any other text

Try putting the following into the GotFocus event of your memo field


Private Sub NOTES_GotFocus()
On Error GoTo Err_Notes_GotFocus


'Assign the existing value to a temporary variable
notes_temp = NOTES.Value

'Use “vbCrLf” as a code segment that can be tested for

If Not (Right(notes_temp, 2) = vbCrLf) Then
NOTES.Value = notes_temp & vbCrLf

' moves the entry point down one line
' if you want to go down two lines use two instances of the vbCrLF command e.g.
' NOTES.Value = notes_temp & vbCrLf & vbCrLf

' place your cursor at the end of the notes field ready for input.

NOTES.SelStart = (Len(NOTES.Value))
NOTES.SelLength = 0



End If
Exit_Notes_GotFocus:
Exit Sub

Err_Notes_GotFocus:
MsgBox Err.Description
End If
Resume Exit_Notes_GotFocus
 
Have you got Autocorrect turned on?

Am I missing something?

I thought autocorrect was a means of propogating changes to the names of objects.

Does it correct other things?
 
Thanks for the help Sprocket I think we are getting close.

You mentioned you can't duplicate the problem. Here is what I am doing, create a table with a memo field in it, go to the datasheet view and add some text with either a space or a line at the end (ctrl-enter). Move to the next record and then back to the original record. On my database the spaces and blank lines have been trimmed. This is where my problem exists.

Your solution will work fine however we needs to have a little more flexibility, for example the user of the form may be adding spaces, or lines or both or any combination. By simply adding a line or space onto the end will not give me the desired results.

Man, what a pain I am ....

Thanks
 
Am I missing something?

I thought autocorrect was a means of propogating changes to the names of objects.

Does it correct other things?
Yes it does. Here's a quote direct from the help file in A2k

You can use the AllowAutoCorrect property to specify whether a text box or a combo box control will automatically correct entries made by the user.
 

Users who are viewing this thread

Back
Top Bottom