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 / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

My Form Will Not Respond To Me.AllowEdits

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Fairfield - 13 Apr 2005 22:52 GMT
I have a form were I changed the lock property to yes for every field to
keep Users from editing the data by mistake. The reason I locked every
field and not the form was to leave one field open to pick companyname and
bring up the record for that companyname. (I should also mention that I
have 2 subforms on this form and the queries and tables used are updatable).

I added an EDIT button to control the edits by prompting for a password.
When the button is clicked, it executes the following code:  

Private Sub EditRcd_Click()
       DoCmd.OpenForm "frmPswrdEdit"
      Me.AllowEdits = True
   
End Sub

Is there something I'm missing?

Thanks for your help on this!!

Tony
Rick Brandt - 14 Apr 2005 00:05 GMT
> I have a form were I changed the lock property to yes for every field
> to keep Users from editing the data by mistake. The reason I locked
[quoted text clipped - 13 lines]
>
> Is there something I'm missing?

Yes, the fact that AllowEdits has nothing to do with the Locked property of your
controls.  If you have individual controls set to Locked = Yes then your button
will have to execute code that sets all of their Locked properties back to No.

Pretty easy to do in a loop.  I usually give all of the controls a common Tag
property ("Lock" for example) and then...

Dim cnt as Control

For Each cnt in Me
   If cnt.Tag = "Lock" Then cnt.Locked = False
Next cnt

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Tony Fairfield - 14 Apr 2005 00:29 GMT
Hi Rick,
I changed all the field property tag to "Lock" and added your code to the
button.  I received a run-time error "438 "object doesn't support this
property or method.  It highlighted "cnt.Lock"

Is there something I forgot to add?

Thanks again!
Tony
Tony Fairfield - 14 Apr 2005 00:48 GMT
okay, it works now, but only for the text boxes.  It doesn't work for the 2
subforms.  I changed the tag for them to "lock", but they are still locked
after running the loop.

Is there a way to unlock the subforms with this routine?

Thanks,
Rick Brandt - 14 Apr 2005 02:47 GMT
> okay, it works now, but only for the text boxes.  It doesn't work for
> the 2 subforms.  I changed the tag for them to "lock", but they are
[quoted text clipped - 3 lines]
>
> Thanks,

I just tested it on a subform and it worked fine for me.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Tony Fairfield - 14 Apr 2005 03:09 GMT
I placed the code in beforeupdate and afterupdate, changing from true to
false.  That worked for me.

I was stuck on this one. Your code really helped.

Thanks for your help!
Tony
 
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.