VB Coding on form

  • Thread starter Thread starter rblivewire
  • Start date Start date
R

rblivewire

I have a form that I am trying to lock past records. I have added an
extra box that tells if the form is locked or unlocked. From this box
I am trying to tell the code that if the box says locked, then the
different text boxes and buttons enabled property will = false and if
the text box says unlocked then the enabled property will = true. I am
having my problem of trying to get this to happen when as soon as you
switch records. Right now I have it so the form goes straight to a new
record. This record should be enabled, but as soon as a user clicks
the back button, the properties on that record will be disabled. I
have tried onload. Any suggestions??
 
Hi.

In the "On Current" event of the form, place this code:

If Me.NewRecord Then
'Enable controls here
Else
'Disable controls here
End If

-Michael
 
perhaps I'm not understanding correctly, but it could be as simple as:

Private Sub Form_Current()
Me.AllowEdits = Me.NewRecord
End Sub
 
Brian Bastl said:
perhaps I'm not understanding correctly, but it could be as simple as:

Private Sub Form_Current()
Me.AllowEdits = Me.NewRecord
End Sub

It might be even simpler. If the form's AllowAdditions property is set
to Yes, and its AllowEdits property is set to No, then new records can
be added but existing ones can't -- with no run-time code at all.
 
You have a point!

Dirk Goldgar said:
It might be even simpler. If the form's AllowAdditions property is set
to Yes, and its AllowEdits property is set to No, then new records can
be added but existing ones can't -- with no run-time code at all.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top