Allow Edits

G

Garry Jones

By using "Me.Form.AllowEdits = True/False" I am allowing the form to be
used as a entry/edit function or just to view the data. I don't want to
use each field's enable/tab stop/locked settings as some fields are
permanently disabled and locked.

1)
I want to turn off all tab stops, disable and lock every field whilst
"allow edits" is false. (lock the form for everything but viewing).

2)
In addition I want to allow new post whilst in "AllowEdits = False" mode
in which case everything is turn on again.

Any suggestions?

Garry Jones
Sweden
 
B

Brian Bastl

Garry,

Here's what I'd do:
Set Allow Edits = True
Allow Deletions = False

then in the forms OnCurrent event

dim ctl as Control
if Me.NewRecord then 'explicitly unlock certain controls for user data entry

With Me.Control1
.Locked = False
Tabstop = True
.TabIndex = 0
End With

With Me.Control2
.Locked = False
Tabstop = True
.TabIndex = 0
End With

With Me.Control3
.Locked = False
Tabstop = True
.TabIndex = 0
End With

Else 'not a new record so lock everything
For each ctl in Me.Controls
ctl.Locked = True
ctl.Tabstop = False
Next ctl
End If

HTH,
Brian
 

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