Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo Field append

Status
Not open for further replies.

jerryreeve

Vendor
Jan 16, 2002
2,765
US
I want the focus (Cursor) to be at the end of the memo field when I tab into it instead of highlighting the entire memo field (and risk loss of all memo's if the user hits any key while highlighted)

I haven't been able to spot the solution for this yet and would appreciate a nudge in the correct direction.

----------------------------
JerryReeve
Communication Systems Int'l
com-sys.com

 
You can use the Enter event with the SelStart property.

Me.txtMemo.SelStart=Len(Me.txtMemo)
 
Or just set it to a number >255 eg.
Private Sub testmemo_Enter()
Me![testmemo].SelStart = 256
End Sub
 
Oops. I was thinking of a regular textbox. Just set it to some big number like 64000. It'll go to the end of the text.
 
the number ended up as no larger than 32767


thanks much for both of you.


----------------------------
JerryReeve
Communication Systems Int'l
com-sys.com

 
That's right, setting SelStart to anything larger than 32767 will cause it to bomb because SelStart takes an Integer.

You could use something like this:

If Not IsNull(MemoBox) Then
If Len(MemoBox) < 32767 Then
MemoBox.SelStart = Len(MemoBox) + 1
Else
SendKeys "^{END}"
End If
End If

but I don't really like using SendKeys, so I use

If Not IsNull(MemoBox) Then
If Len(MemoBox) < 32767 Then
MemoBox.SelStart = Len(MemoBox) + 1
Else
MemoBox.SelStart = 32767
End If
End If


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
See that. You always learn something around here. I have no documentation on that. Never researched it 'cause nobody that I created memo fields for ever wrote that much. File that one away. Thank you.
 
That's why Access is so much fun, to me! I primarily work in the health care field, and thus use a fair amount of memo fields, for things such as progress notes, nursing notes, etc. Memo fields have a bad rep, but if they're used just for notes, to be printed, if need be, but never to be searched or sorted or manipulated in any way, they're very handy.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
thanks a load. Here is what I ended up with for the code.

Code:
Private Sub memCallNote_Exit(Cancel As Integer)
Me.CallLog = Date & " " & Time() & " " & currentUser() & ":  " & Me.memCallNote & vbCrLf & Me.CallLog
Me.memCallNote = ""
Me.txtRecallDate = ""

End Sub
this gives me the result of
Code:
9/6/2008 5:34:36 PM testuser:  information about the event I was interested in
followed by all the rest of the log as it existed before the update then it resets the callnote memo box to blank and parks the cursor in the recall date box to put in a date for the next call to that contact/customer

only problem that I see in the future is that after about 6 or 8 pages it becomes "too big to be edited" and won't allow more additions.

----------------------------
'Rule 29', "The enemy of my enemy is my enemy's enemy. No more. No less."
----------------------------
JerryReeve
Communication Systems Int'l
com-sys.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top