SelStart being overridden by full text selection when... (1 Viewer)

EdFred

knows enough, dangerous
Local time
Today, 16:24
Joined
Mar 2, 2007
Messages
129
...I resize a field.

Access2007 (yep, still works, and not going to 365)
Win10x64

I have a SubForm (continuous) that I am logging conversations we have with customers: custID, convoDate, EmployeeID, Contact, Conversation. The conversation notes could get rather long, but I only want the default view to be a single line for readability (scrolling through history) purposes, but want the ability to see the whole conversation when a user enters that field, but I don't want them accidentally deleting conversations already entered so this is what I have:

Private Sub Conversation_Enter()
Me.Detail.Height = 2520
Me.Conversation.Height = 2520
Me.Conversation.SelStart = Nz(Len(Me.Conversation), 1)
End Sub

And resizes when exiting.

Private Sub Conversation_Exit(Cancel As Integer)
Me.Conversation.Height = 315
Me.Detail.Height = 315
End Sub

This works perfect, except for one glitch: When I am 3 to 4 records down (or far enough that records start to scroll off the top of the screen) the SelStart is overridden. The entire text is selected and any keystroke (other than TAB) will overwrite the selected text. I've narrowed it down to the resizing of the field as the issue. If I don't reset the size to normal view (315) then I don't get the full text selection. I've tried repainting, I've tried the order of which the resize and SelStart happens, I've tried SelLength. I've contacted other people.

This behavior exists when I open the subform on it's own. And it's definitely a screen size issue, because if I resize the main window in Access it happens as soon as any record is pushed off the top of the viewable area.

Anyone got any ideas?

Yeah, I know this is clunky, but I can't trust users to use Shift+F2 or to correctly edit/enter text from a pop over, or from an unbound textbox from the main form without doing something that causes the SaveRecord, DropChange CopytoClipboard dialogue that pops up.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:24
Joined
May 21, 2018
Messages
8,527
can you provide a couple of screen captures of how this is set up. Hard to visualize the set up and the issue.
Could a zoom pop up be a solution, where they could double click and see the whole conversation, but leave it as un editable. Guessing here because I do not fully understand the question or set up.
 

isladogs

MVP / VIP
Local time
Today, 21:24
Joined
Jan 14, 2017
Messages
18,219
Have a look at forms 1-3 in this example where a custom form similar to a zoom box pops up automatically below the field/record clicked.
Accurately move forms and controls
 

EdFred

knows enough, dangerous
Local time
Today, 16:24
Joined
Mar 2, 2007
Messages
129
Problem solved, only took a coupl hours to figure it out.

Set the focus, even though I was already in the field

Private Sub Conversation_Enter()
Me.Detail.Height = 2520
Me.Conversation.Height = 2520
Me.Conversation.SetFocus
Me.Conversation.SelStart = Nz(Len(Me.Conversation), 1)
End Sub

(I had screen shots up, but took them down as there was some info I didn't initially see that didn't need to be shared)
 
Last edited:

Users who are viewing this thread

Top Bottom