This one is killing me!
I have investigated this thing way too long for what it's worth, but my OCD isn't letting me stop LOL.
Whenever a user pastes text with formatting into a memo field Access cannot decipher this and Marks the value with a funky question-mark surrounded by a rectangle. I looked this up and they said that all I had to do was change the plain text value to rich text and that would solve the problem... this is untrue. here's the article (I am only posting this so no one posts it as an actuall solution, because it isn't): http://office.microsoft.com/en-us/access-help/insert-or-add-a-rich-text-field-HA010014097.aspx
That said, I looked up a posisble solution to the issue would be to take out the non-printable ASCII characters beforehand... http://answers.microsoft.com/en-us/office/forum/office_2007-access/problems-trying-to-import-a-csv-file/e1e5e1b4-4ddf-48dd-83a5-e0bd0b21733a
This seemed logical. What I don't want to do is go in and change every memofield in my rather lengthy form... What I would like is to have the user click in the memo field they wish to populate then click a "paste text" button.
Once they to this I would like this button's OnClick sub to:
1) find and save the last text control that had focus
2) open an input box allowing users to paste their formatted text into
3) take the text from the inputbox and run a format cleansing function
4) Post this newly cleaned text back into the last text control that had focus
5) set the focus to said control.
I think I am almost there, but I am having issues.
This code seems to remove the non-printable ASCII:
Here's where I am having the problem, this code isn't working:
If anyone has a better way, I am all ears!
Thanks in advance!
Gary
I have investigated this thing way too long for what it's worth, but my OCD isn't letting me stop LOL.
Whenever a user pastes text with formatting into a memo field Access cannot decipher this and Marks the value with a funky question-mark surrounded by a rectangle. I looked this up and they said that all I had to do was change the plain text value to rich text and that would solve the problem... this is untrue. here's the article (I am only posting this so no one posts it as an actuall solution, because it isn't): http://office.microsoft.com/en-us/access-help/insert-or-add-a-rich-text-field-HA010014097.aspx
That said, I looked up a posisble solution to the issue would be to take out the non-printable ASCII characters beforehand... http://answers.microsoft.com/en-us/office/forum/office_2007-access/problems-trying-to-import-a-csv-file/e1e5e1b4-4ddf-48dd-83a5-e0bd0b21733a
This seemed logical. What I don't want to do is go in and change every memofield in my rather lengthy form... What I would like is to have the user click in the memo field they wish to populate then click a "paste text" button.
Once they to this I would like this button's OnClick sub to:
1) find and save the last text control that had focus
2) open an input box allowing users to paste their formatted text into
3) take the text from the inputbox and run a format cleansing function
4) Post this newly cleaned text back into the last text control that had focus
5) set the focus to said control.
I think I am almost there, but I am having issues.
This code seems to remove the non-printable ASCII:
Code:
Function StripReturns(varIn As Variant) As Variant
Dim lngX As Long
Dim varName As Variant
Dim varNewName As Variant
Dim varY As Variant
If Not IsNull(varIn) Then
varName = varIn
For lngX = 1 To Len(varName)
varY = Mid(varName, lngX, 1)
If (Asc(varY) > 31) Then
varNewName = varNewName & varY
Else
varNewName = varNewName & " "
End If
Next lngX
StripReturns = varNewName
End If
End Function
Here's where I am having the problem, this code isn't working:
Code:
Private Sub btnRemovePasteFormat_Click()
Dim strInput As String
Dim strPrevControl As String
strPrevControl = Screen.PreviousControl.Name
strInput = InputBox("Past Text")
Forms![00120_Agreement]!strPrevControl.ControlSource = StripReturns(strInput)
End Sub
If anyone has a better way, I am all ears!
Thanks in advance!
Gary