Form.Detail DO or DONT allow edits to the controls (text boxes)

V

Vsn

Hi all,

I have a continious form on which some records are 'open' for edit and
others aint depending on the flag . Now I thought I could handle that with
the code shown below. Unfortunatly the code does not do the job.

Could anyone suggest a methode which could do it?

Private Sub Form_Current()
'Check ik record is locked if YES dont allow edits to the form detail
section
Dim cntl As Control
If Me.fPayCheck = True Then
For Each cntl In Me.Detail.Controls
AllowEdits = False
Next
Else
For Each cntl In Me.Detail.Controls
AllowEdits = True
Next
End If

End Sub


Thanks a lot,
Ludovic
 
D

Dorian

On a continuous form all rows are treated the same.
You could insert code in the BeforeUpdate event to allow or disallow saving
the row.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
M

Marshall Barton

Vsn said:
I have a continious form on which some records are 'open' for edit and
others aint depending on the flag . Now I thought I could handle that with
the code shown below. Unfortunatly the code does not do the job.

Could anyone suggest a methode which could do it?

Private Sub Form_Current()
'Check ik record is locked if YES dont allow edits to the form detail
section
Dim cntl As Control
If Me.fPayCheck = True Then
For Each cntl In Me.Detail.Controls
AllowEdits = False
[,,,]

AllowEdits is a form property, not a control property. To
disallow edits to all the controls, your code could simply
be:
Me.AllowEdits = Not Me.fPayCheck

OTOH, if you want to allow some controls to be edited, then
Lock and/or Disable just those controls.
 

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

Top