Results 1 to 6 of 6
  1. #1
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117

    Lock one form from another form

    Hi guys, I posted before but didn't state my problem clearer because I noticed I had a different problem.


    I have a combo box on a form that has three options, "Draft", "Pending", and "Final" which decides the status of a form because of an approval process, and I have three of the same forms but with different stuff on each because of an approval process of the forms. The first form is filled out by the customer then gets sent to the first approver, the combo box which is locked is automatically on "draft" for the status, because the customer does not have the option to change the status. The approver will open up the same form but have the option to change the combo box to "Pending", once the approver hits pending for the status, he sends it the next approver who opens up the same form but changes the status to "final". How do I code it if possible that when the first approver changes the status to "pending" it locks the first form filled out by the customer, and when the second approver changes the status to "final" it will leave the first form locked as well.


    Thanks, all help appreciated!

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Kinda of confusing, you say you have 3 forms but then the approver opens the same form, etc.? Can you give more detail and list out all the forms and which one has combo boxes, etc. But you can put code in one of the form events or on the AfterUpdate of the combo box to lock fields or a form.

    If me.combobox = "Draft" then Forms![CustomerForm].Locked = True

  3. #3
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    All the forms have combo boxes, on the first form it is locked though on draft, because it can only be changed by the approver. The approver then opens his form which is basically the same information which the customer filled out but now has another box that he can sign which the customer could not see before, and he has the option to change the combobox value to pending, then same thing for the last approval, except he switched it to final. But once the approver hits pending of final it will lock the first form the customer filled out, so I basically have three copies of the same form but each person has different stuff on each. Thanks, hopefully it makes sense.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    I assume you are doing this so that once the review process starts(it is put in Pending or Final status), you don't want the customer to go and change anything on the form right? If so then I think you need to add a condition to the first form to check that status field. If it is Draft, then the form can be edited. If it is Pending or Final, it cannot be edited. If that is how it needs to work, then on the Customer form in the OnOpen Event, put:

    If me.Status = "Pending" or me.Status = "Final" then
    Forms!frmCustomer.allowEdits = False
    End If

  5. #5
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Ok but this will only lock the customer form then, right, the approver forms would still have access to change anything right on their form right? thanks for the help!

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    Agree with the proposal. However, you cannot check the value of a control in the Open event. It has to be in the Load event.

    There should only be one form if the only difference is that some fields are not visible according to your user level. If you had to add one field to the first user's data, you'd have to redesign 3 forms. That's not a great idea. When locking (or not) a form, that is the time to show or not show controls.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form Status Enable or Lock Form
    By banpreet in forum Programming
    Replies: 11
    Last Post: 12-02-2016, 01:08 PM
  2. Lock a field on a form
    By pbouk in forum Forms
    Replies: 3
    Last Post: 03-25-2013, 10:45 PM
  3. Replies: 1
    Last Post: 07-18-2011, 03:08 AM
  4. Lock Focus on the Current Form
    By injanib in forum Forms
    Replies: 6
    Last Post: 05-29-2011, 04:22 AM
  5. Form : Lock all controls in form
    By dek in forum Forms
    Replies: 3
    Last Post: 05-09-2011, 01:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums