Re: How to make the form read only when field status is CLOSED

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Mario" <Mario@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4A6355C0-E83A-4A32-AD13-CA8F9F30C93D@xxxxxxxxxxxxxxxx
I have a DB of Issues, there is a field Status (Active Closed Resolved).
I need when a person change the STATUS field to CLOSE to automatticaly set
the Edit to "NO" so the fields in the form would show in Read Only, BUT
leave
the field STATUS open for edits to Reopen the Issue. I may have an idea
how
to do that but don't know how to coded, can these be done with a macro or
VB
code. Can somebody give me some direction?
Tks in advance.
Mario


Since you want to lock all but a single field you'll need to loop through
all controls on the form and set each one's Locked property to True. Create
a sub procedure something like this:

Sub LockControls(bLock As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Lock" Then
ctl.Locked = bLock
End If
Next ctl
End Sub

For each control you want locked, enter the text "Lock" (without the quotes)
into the Tag property. Then, in the AfterUpdate event of the STATUS field,
call LockControls and pass the appropriate Boolean value:

If Me.STATUS = "CLOSE" Then
LockControls True
Else
LockControls False
End If

Carl Rapson


.



Relevant Pages

  • Re: User level access to data entry
    ... You only need to tag the control you want to unlock. ... Dim ctl As Control ... we can allow a read only user to edit one field in a particular form. ...
    (microsoft.public.access.formscoding)
  • Re: allow edits = no doesnt work - continuous forms
    ... > but to set the Locked property of each bound control instead. ... > want to lock the record based on the value of some control, ... > Dim ctl As Control 'Each control on the form ... >> code and the Edit button code. ...
    (microsoft.public.access.forms)
  • Re: setting tag properties to locked fo every record
    ... allow you to edit that one record, but when you move to another, the Locked will be ... Dim ctl As Control ... ' Loop through each control on the form and change where Tag = "FILTER" ... For Each ctl In Me.Controls ...
    (microsoft.public.access.formscoding)
  • setting tag properties to locked fo every record
    ... still able to edit records, having only pressed the edit button once on a ... Dim ctl As Control ... ' Loop through each control on the form and change where Tag = "FILTER" ... For Each ctl In Me.Controls ...
    (microsoft.public.access.formscoding)
  • Re: I want to get rid of a beep
    ... If I press enter when the edit box has focus, ... MyEditBox::MyEditBox(CWnd *parent, UINT nID) ... You cannot possibly know the dimensions of an edit control so ... MyEditBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) ...
    (microsoft.public.vc.mfc)