Date stamp in Memo field - without SendKeys

G

Guest

I was advised a few days ago to rewrite various bits of code that used
SendKeys as that function has become v temperatmental. I have replaced
almost everything but there is one seemingly simple application that I just
can't replicate.

I have a series of memo fields where users add their own comments about a
particular record. If they press a datestamp button, the SendKeys based code
will add the date and their name to the top of the memo field and the
insertion point will then be in exactly the right position for them to type
their comment. The SendKeys based code I've been using is below.

Without SendKeys, I've been able to add the datestamp information to the top
of the memo field - but I cannot find a way to then move the insertion point
to the correct place within the memo field - just below the datestamp info.
Any ideas?
Thanks

Public Function DateStamp(StampControlName As Variant) As Integer

DoCmd.GoToControl StampControlName

SendKeys "{F2}^{Home}^{Enter}^{Enter}^{Home}" & Format$(Now, "dddd mmmm d,
yyyy hh:nn AM/PM") & " - " & Forms!settings!user.Column(1) & "^{Enter}"

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top