Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Lock/Un-Lock Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Randy - 14 Jun 2007 01:01 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.