Link to home
Create AccountLog in
Avatar of Drjdh
DrjdhFlag for United States of America

asked on

Extra spaces introduced into control.

I have a control on a form that is populated with text strings that are programmed behind form buttons.  Here is a typical line of code:

Private Sub DietButton_Click()
Me.Text341 = Me.Text341 & "<br/><b><u><FONT COLOR=#e6ffcc>Diet</FONT></u></b>: "

End Sub

Open in new window


The code works well, however, when I decide to add some free form text to the control, and then subsequently enter more text using the button, there is an extra space introduced after my free text on the control.

Any idea on how to eliminate this problem?

Your help is greatly appreciated.
Avatar of jerryb30
jerryb30
Flag of United States of America image

maybe Me.Text341 = Trim(Me.Text341 & "<br/><b><u><FONT COLOR=#e6ffcc>Diet</FONT></u></b>: ")
Avatar of Drjdh

ASKER

Thanks Jerryb30. Do you know why the extra space gets added?  I'm sure that this must be a common problem, no?
I would have to see a pic of the control with extra space before I could guess.
Avatar of Drjdh

ASKER

I manually entered "thrush" and as you can see when I resumed entering scripted text with the use of buttons a new line was entered.
space.PNG
Please show what it was before you entered 'thrush'. Plus the code before and after.
Avatar of Drjdh

ASKER

The text prior to entering "thrush" was exactly everything that you see up until the word "thrush". The code which inserts the text strings is identical to the one above except for the text that it enters. ie:

Private Sub Command355_Click()
Forms!PhysicianRecordForm.Text341 = Forms!PhysicianRecordForm.Text341 & "Mucus membranes intact, no abnormalities. "
End Sub

Open in new window

Let me try to re-create.
Can't recreate issue. Probably has to do with how control is populated. Can you post your form and any other underlying code?  No data necessary.
Avatar of Drjdh

ASKER

That will be very difficult to post.  There is much code. Basically, if I click in the control it does not enter a new line of text in the field, but when I type anything (including a space) in the control it creates a carriage return.
Avatar of Drjdh

ASKER

I see. If I cut and paste the contents of the control onto Word and show hidden symbols. Whenever I type in the control a new Paragraph symbol is added.  I don't understand this behavior.
ASKER CERTIFIED SOLUTION
Avatar of jerryb30
jerryb30
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer