• Selectively Locking Fields on a Continuous Form (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Selectively Locking Fields on a Continuous Form (Access 2000)

    Author
    Topic
    #380065

    I’ve got a continuous form that I need to lock or unlock the detail fields depending upon the state of a yes/no
    field in the record (represented as a checkbox on the form). I know how to iterate through the fields on the form, but how would I do this for each record in the query on which the form is based? I’ve thought about putting code in the On Current event for each field, but this seems like it would incur a great deal of overhead when moving from record to record. Basically, I need to prevent data modifications in records that have been approved by management, but leave unapproved records unlocked.

    Thanks.

    Viewing 3 reply threads
    Author
    Replies
    • #635000

      I would just use the oncurrent event to lock /unlock fields depending on the value in the Approved field

    • #635037

      I use On Current code frequently for other things. As long as your code is simple, I don’t believe you’ll see significant slowdowns using it to lock/unlock records.

    • #635044

      Let me add that this can get pretty tricky as your code will unlock all records, as continuous forms don’t distinguish between records. However as long as you relock the controls in a rigorous fashion, you should be OK – probably on Lost Focus. Another solution might be to either use two subforms, or set a filter to only show unapproved records, and unlock the controls as long as that filter is in effect.

      • #635097

        I suppose that it can’t hurt to be very careful, but I would have thought that any attempt to change the value in a different rocord (that I supposed to be locked) will first trigger then oncurrent event again, and that will lock (and/or disable) the control and stop the change.

    • #635179

      My 2cents worth

      What about using the forms BeforeUpdate event to check if it is allowed to update and Cancelling changes if disallowed?

      I think you can use conditional formatting to selectively lock/unlock controls on a continuous form as well (A2K and higher)

      • #635754

        Hey, I like this idea. Using this method, I can make the check and tell the user what to do if the record is locked. If it’s locked I can abandon the changes.

        Thanks to all for the good ideas.

    Viewing 3 reply threads
    Reply To: Selectively Locking Fields on a Continuous Form (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: