Editing Data in Form

D

Don Stone

Greetings--

I have a form in A2003 format being designed in A2007. I set the Form Data
properties to "No" for Entry, Additions, Deletions, and Edits. However,
when the form is opened, I can edit the form fields.

Can anyone explain to me why the fields are editable after I have set the
"Allow Edits" to No?

It would seem to be a straightforward scenario but....

Thanks for any help someone can give me.

Don
 
M

Maurice

I don't have an explanation as to why you can still edit the form but why
don't you open the form 'read only' and see if that helps.

DoCmd.Openform "formname", , , , readonly

hth
 
J

Jeff Boyce

I believe the Edit, Additions, ... properties pertain to the data, not the
form.

I also believe you can disable the ability to edit the form itself.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Don Stone

Thanks for the reply.....

I also believe that the "Allow Edits" property applies to the data not the
form. It is the data that is editable on my form despite being told to not
be editable.

Also, I'm not wanting to edit the form, just the data. I'm trying to keep
the data from being edited until a button is clicked which changes the data
properties to become editable.

Best regards,
Don
 
L

Linq Adams via AccessMonster.com

It always amazes me how questions run in cycles. I've read this same question
twice in the past 24 hours!

My guess is that you're doing something in code, probably in your Form_Open,
Form_Load or Form_Current event to assign a value to a control. When you do
this the current record then becomes editable.

Moving to another record will reset the locked state. If this is happening in
the Form_Open or Form_Load event, you can follow the assignment code with

DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious

and this will reset it. If it's in the Form_Current event you'll probably
need to rethink your design.

BTW, the same thing will happen if you open the form in ReadOnly mode.
 
J

Jeff Boyce

Don

Sorry, I misunderstood. "... edit the form fields..." implied to me that it
was the underlying controls, not the values, that were being edited.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Don Stone

Thanks for the info but then again no thanks :(

My Form_Current is full of the enabling/disabling numerous controls. And,
my Form_Open is full of visible/invisible settings of many other controls.
Therefore, it seems that I have a definite problem, right?

It appears as if my wanting "no editing" of data on the form is not going to
happen or I must design the form differently.

Do you have any other suggestions?

Thanks again for clearing up my problem.

Don
 
J

Jeff Boyce

Don

I have some forms in an Access 2007 application for which I define the
RecordsetType property as "Snapshot" in the forms' OnLoad events. The data
displayed is not updatable.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

AccessVandal via AccessMonster.com

I'm not sure that this will help. It might help if you do a Debug.Print just
before the End Sub of the two events.

Debug.Print Me.AllowEdit
...so on

Just in case that you might have a problem setting the correct value due to
an error in your code.
 
D

Don Stone

Thanks for the idea.....

AccessVandal via AccessMonster.com said:
I'm not sure that this will help. It might help if you do a Debug.Print
just
before the End Sub of the two events.

Debug.Print Me.AllowEdit
..so on

Just in case that you might have a problem setting the correct value due
to
an error in your code.
 
M

Mr B

Don,

I would suggest that you set each control to "Locked" as the last thing just
before presenting the form to the user.

You can create a user defined function to accomplish this and call it when
you need to lock or unlock the controls.

For example:

Function LockCtrls(status As Boolean)
Me.txtFName.Locked = status
Me.txtMName.Locked = status
Me.txtLName.Locked = status
End Function

Then as the last thing in your Form_Current event:

LockCtrls True

In the code of your button you can use:

LockCtrls false

Using this method you can even control individual 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