(MS Access - Office 365)
By way of background, I record clinical notes for feline (cats) welfare for our charity cat rescue group. Each cat has a separate Record which is held in an MSAccess database. I use a data entry form with fields that record the specific details of each cat.
So, one field involves the continuous day to day recording of clinical notes. I created a long text field "ClinicalNotes" to accommodate them. Next to this text box on the form I have a button that runs a small macro. The macro uses SendKeys to perform some basic tasks. (See image attached.) This results in the following:
newer date, newer time,
newer clinical note
older date, older time,
older clinical note 1
e.g.
02-Sep-20@9:19:57 AM
(user starts typing newer clinical note here)
02-Sep-20@8:28:51 AM
Mild renal azotaemia CREA 200
So, I use SendKeys to manage the date and time stamp which is set up in a macro that is called when a button is pressed on the Record (one of several Records that are created for each feline).
As SendKeys appears to clear the field which causes all the previous clinical notes to be erased (which I don't want to have happen) , I have had to find a workaround to copy the existing content of the field first, then run SendKeys, and re-paste the copied contents back to the field. Then when the record is closed, the text in the ClinicalNotes field remains intact.
When I move onto another Record. This is when the problem starts. It has to do with what is still on the clipboard active in Access.
When the new Record field is blank, there is nothing to copy (my SendKeys routine is trying to copy text), so the clipboard retains the last pasted contents of the previous Record or, for that matter, anything it is holding . The problem is that the Record clinical notes from the previous Record may be inappropriately cloned to the new Record, or the new Record deposited with material that shouldn't be there. The new Record might be an existing record with or without clinical notes.
I've been looking to find a way of clearing the active clipboard contents when the button next to the ClinicalNotes field on the form is pressed using a VBA or SendKeys entry in the DateTime macro.
Can I have some help with this one please? Thank you.