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 / November 2007

Tip: Looking for answers? Try searching our database.

Locking records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Anders - 10 Nov 2007 13:16 GMT
Hi!

I have a form for orders and a subform for order details. After invoicing a
checkbox turns to "Yes" which means the order has invoiced.  I have done a
code to lock records non editable. It works on the main form perfectly but on
the subform not. The code is following:

Private Sub Form_Current()
If Invoiced = True Then
Me.AllowEdits = False
Else
AllowEdits = True
End If
End Sub

I have tried that code with the subform various events but allways I can
edit records on the subform although not on the main form. What kind of
procedure is needed for the subform to lock records like the main form?
Signature

Have a Nice Day!

Allen Browne - 10 Nov 2007 13:24 GMT
Why not set the AllowEdits property of the form in the subform as well?

Presumably you want to block deletions as well as edits if it is invoiced,
so something like this:

Private Sub Form_Current()
   Dim bLock As Boolean

   bLock = Nz(Me.Invoiced, False)

   If Me.AllowEdits <> bLock Then
       Me.AllowEdits = bLock
       Me.AllowDeletions = bLowk
       With Me.[Sub1].Form
           .AllowEdits = bLock
           .AllowDeletions = bLock
       End With
   End If
End Sub

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi!
>
[quoted text clipped - 16 lines]
> edit records on the subform although not on the main form. What kind of
> procedure is needed for the subform to lock records like the main form?
 
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.