Read Only when Checked?

Lister

Z Shift
Local time
Tomorrow, 03:53
Joined
Aug 24, 2003
Messages
305
Hey All
I have a purchase order form, that has two combo boxes and a sub form.
It also has a date field and check box to be filled in when the goods arrive and are checked in.

At the moment there is nothing wrong with the form it works fine. But I have a problem with users going back in and changing the order after it has arrived. As you can imagine it make reconciling purchase orders with invoices a real pain.

What I would like is that once the check box is ticked, all the fields in the form become Read Only.
But only for that record, if the check box is not ticked the order could still be changed.
This way we can still change the record as we have to do some times because of supplier constraints.
But once its check in, it couldn’t be changed.

So I’m thinking an event off the check box would be the easiest way.
I would think that there would be a simple bit of code out there to do this.

If anyone could give me a hand, that would be great.
Thanks

:)
 
Use the Current event of the form:

Code:
If Me.YourCheckBox = True Then
    Me.AllowEdits = False
    Me.AllowDeletions = False
    Me.MyLabel.Visible = True
Else
    Me.AllowEdits = True
    Me.AllowDeletions = True
    Me.MyLabel.Visible = False
End If

Call this code also from the AfterUpdate event of the form to handle the case when the check box changes. You might want to also include a label that you make visible or invisible so the user has a strong visual clue.
 
Thanks Pat

I will give this ago tomorrow.
 
Hi Pat
I tried it and it works great.
I inserted a new label that marks them as finished which I think will help, as you suggested.

But the Subform is still writeable (< is that a real word?). Is there another line I could add to the code to make it read only as well?

Code at the moment…

If Me.Arived = True Then
Me.AllowEdits = False
Me.AllowDeletions = False
Me.Label73.Visible = True
Else
Me.AllowEdits = True
Me.AllowDeletions = True
Me.Label73.Visible = False
End If

The Subform is [Purchase Sub subform1]

This has been a big help, thanks Pat

Lister
 
The same code you used for the main form should be used for the sub form

If Me.Arived = True Then
Me.[Purchase Sub subform1].Form.AllowEdits = False
Me.[Purchase Sub subform1].Form.AllowDeletions = False
Me.[Purchase Sub subform1].Form.AllowAdditions = False

Else
Me.[Purchase Sub subform1].Form.AllowEdits = True
Me.[Purchase Sub subform1].Form.AllowDeletions = True
Me.[Purchase Sub subform1].Form.AllowAdditions = True
End If

Add the lines in your If statement
 
Last edited:
Kick ass
Thanks Pat and thanks theprez.
You guys have made me look so good I could almost take the rest of the day off here.

Thanks :D
 
PO solution

Lister said:
Kick ass
Thanks Pat and thanks theprez.
You guys have made me look so good I could almost take the rest of the day off here.

Thanks :D

In no way confessing in anyway to know huge amounts as these guru's do I had a similar problem with purchase orders.

I simply created a purchase order with full delete rights in the sub form also in the main form I disabled the page up / down buttons and the mouse wheel plus starting the PO on a new form. This takes care of the ordering.

Secondly for order history I simply copied the first PO form into another and changed all the rights to NO. e.g no add, edit delete etc. This gives a visual representation for cross referencing delivery notes to PO's without the ablility for the user to destroy and information with regards to the original.

For editing I have another copy in an admin area with full access rights to all fields.

Just and idea and I may have grasped the wrong end of the stick. Obviously I have not given you the full ins and outs of my system but It worked for me and the users cant tamper with history.

Regards

Adrian
 
Last edited:

Users who are viewing this thread

Back
Top Bottom