Solved Maintain vertical scrollbar current position in text box upon clicking on another control (1 Viewer)

Harry Paraskeva

Registered User.
Local time
Today, 06:37
Joined
Sep 8, 2013
Messages
67
My issue may sound a bit silly and there may be an obvious solution I'm just not seeing, but here goes nothing:
- I have a text box (Long Text, non-RTF) occupying the left half of a form. This text box stores large amounts of text, usually running several pages long.
- The right half of the form houses several other controls (textboxes, combo-boxes, etc.).

The idea was that the user would be able to read the text on the left half of the screen, and fill in data in the controls on the right-half of the screen. However, whenever one clicks to any of the controls on the right-half of the screen, the scrollbar of the text box resets to the top of the text, which kind of makes it impossible to actually do the analysis.

Is there any way to make the scrollbar stick/lock to its current position instead of going all the way to the top when the textbox loses focus?
 

Harry Paraskeva

Registered User.
Local time
Today, 06:37
Joined
Sep 8, 2013
Messages
67
So I had to think a bit outside the box for this one, but I think I got a pretty decent workaround and since some people seem to be looking for similar solutions out there, here goes:
- Used a default textbox (Transcription) in Access that is meant for editing the text.
- Used a second textbox, but this time is the MS Forms 2.0 TextBox ActiveX control (Transcription_View) bound to the same source as the above, but locked. This is meant only for viewing the text and its scrollbars do not reset when the control loses focus, hence the user can have the text stopped at any line and go on other controls on the form to insert data. This control is hidden and locked by default.
- Inserted a toggle button with this code:
Code:
Private Sub ToggleText_Click()
If Me.ToggleText.Caption = "View Text" Then
Me.Transcription.Visible = False
With Me.Transcription_View
.Visible = True
.FontSize = 14
.FontName = "Calibri"
.SetFocus
.SelStart = 0
End With
Me.ToggleText.Caption = "Edit Text"
ElseIf Me.ToggleText.Caption = "Edit Text" Then
Me.Transcription.Visible = True
Me.Transcription_View.Visible = False
Me.ToggleText.Caption = "View Text"
End If
End Sub

It's a workaround that requires an extra user click, but I think it solves a lot of the issues of having to deal with an ActiveX control editing long text. Unless there is a more elegant solution, I'll consider the workaround a solution.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:37
Joined
May 7, 2009
Messages
19,231
another approach is to have another form (say Form2) with just the Memo field as its control.
make Form2 a subform of you main form.
create the appropriate Master/Child Link fields for the subform.
 

Harry Paraskeva

Registered User.
Local time
Today, 06:37
Joined
Sep 8, 2013
Messages
67
another approach is to have another form (say Form2) with just the Memo field as its control.
make Form2 a subform of you main form.
create the appropriate Master/Child Link fields for the subform.
I confirm that this works too! Thank you for sharing this, I'm sure it will help several people.
 

Users who are viewing this thread

Top Bottom