Hello again....I have a code that when a form is opened it copies data from
one field and pastes into another field. The problem is I need the field the
funtion is copying data into to remain locked. However, if the field is
locked the copy function does not work.
I need this funtion to be able to unlock the field, then copy the data into
the field and lock the field back up again. Any suggestions will of course be
greatly appreciated.
Here is my code so far:
Function LastModified_CopyFuntion()
On Error GoTo LastModified_CopyFuntion_Err
DoCmd.GoToControl "DateModified2"
DoCmd.RunCommand acCmdCopy
DoCmd.GoToControl "History2"
SendKeys "{Right}", True
SendKeys "{Enter}", True
DoCmd.RunCommand acCmdPaste
SendKeys "{Tab}", True
LastModified_CopyFuntion_Exit:
Exit Function
LastModified_CopyFuntion_Err:
MsgBox Error$
Resume LastModified_CopyFuntion_Exit
End Function

Signature
Randy Street
Rancho Cucamonga, CA
Scott McDaniel - 14 Jun 2007 01:06 GMT
> Hello again....I have a code that when a form is opened it copies data
> from
[quoted text clipped - 8 lines]
> be
> greatly appreciated.
You can copy data much more easily:
me.History2 = Me.DateModified
Randy - 14 Jun 2007 19:38 GMT
Thanks Scott for your suggestion. I did try it, however, doing this way
causes the existing data in that field to be overwritten or wipped out. I
need to be able to retain the existing data in that field in addition to
adding more data. The way I have it it sends the cursor to the end of the
field and then copies the data into the field preserving the existing data
within that field. If there is a better way of doing that please let me know.
I could set the keyboard to automatically go to the end of the field but that
is a global setting and messes up the rest of my forms.

Signature
Randy Street
Rancho Cucamonga, CA
> > Hello again....I have a code that when a form is opened it copies data
> > from
[quoted text clipped - 12 lines]
>
> me.History2 = Me.DateModified