Conditional locking to prevent editing

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

We have a form that is used to construct our sales invoices. Up until the
point where the data is transferred to our accounting system, users need to
be able to edit the forms and amend the invoice contents.
Once an invoice has been transferred, the status field on the form is
changed from Draft to (surprise surprise) Transferred.
Once this has occurred I would like to prevent anyone editing the invoice
any further.
So it's a conditional situation: if the value in the status control is
Draft, users should be able to edit the form in full. If the value is
Transferred, they should be able only to view.
I have tried fiddling around with some code in the Open and Load events but
could not get it right - how and where should I code this, please?
Many thanks
CW
 
Something like:

Private Sub Form_Current()

If Me.txtStatus = "Transferred" Then
Me.AllowEdits = False
Me.AllowDeletions = False
Else
Me.AllowEdits = True
Me.AllowDeletions = True
End If

End Sub

...using *your* txtStatus control name of course.
Thanks - can you help me with what it should be, please?
Thanks
CW
Your code should be in the Current event of the form.
[quoted text clipped - 12 lines]
 
I'll give that a try - thanks a lot
CW

ruralguy via AccessMonster.com said:
Something like:

Private Sub Form_Current()

If Me.txtStatus = "Transferred" Then
Me.AllowEdits = False
Me.AllowDeletions = False
Else
Me.AllowEdits = True
Me.AllowDeletions = True
End If

End Sub

...using *your* txtStatus control name of course.
Thanks - can you help me with what it should be, please?
Thanks
CW
Your code should be in the Current event of the form.
[quoted text clipped - 12 lines]
Many thanks
CW

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top