Disable Form text fields after Data entry

  • Thread starter Thread starter Ajay
  • Start date Start date
A

Ajay

I have designed a Database but users seem to edit records after printing off
reports.
Is there any way that to disable form fields after Data entry in the same
form??
 
You can use the afterupdate event on the control in conjunction with the
form's current event to chack and see if there is a value in the control and
enable/disable it accordingly.

You can test the controls value using something like

If isnull(me.controlname) or me.controlname="" then
'Enable control
Me.controlname.Enable = True
'Etc
Else
'Disable control
Me.controlname.Enable = False
'Etc
End if
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 
I have designed a Database but users seem to edit records after printing off
reports.
Is there any way that to disable form fields after Data entry in the same
form??

Sounds like some user training would be more appropriate. Surely you want to
be able to bring up existing records and correct errors in them, do you not!?

You may also want to have the Form automatically move to a new record upon
opening, so users don't naively overwrite the first record in the
recordsource. You can put a line of code in the form's Load event

Private Sub Form_Load()
DoCmd.GoToRecord acDataForm, Me.Name, acNewRecord
End Sub

or - if users should routinely only add records and never even see old ones -
set the Form's Data Entry property to True.
 
Hi Ajay,

I have to agree with John, it appears as though some user training would
help. However, I go through this same thing everyday and they still mess
something up.

I would go with Daniel's code. It will allow you to enter data and change
whatever needs to be change before the record is added. If you find something
needs to be corrected, that should be a supervisor or manager (one for
security reasons and also gives managetment who is making all these errors
that need to be fixed). Please a password field and a command button on the
form so that when the password is entered it will unlock or enable the fields
and allow you to edit as many records as needed until you close the form then
it will reset itself.

I know it seems like a unecessary process to through but you do what you
gotta do to keep the peace. :o)
 
I have to agree with John, it appears as though some user training would
help. However, I go through this same thing everyday and they still mess
something up.

<wry grin> Yeah, you build a fool-proof application and the fools just get
better at it.
 
Back
Top