Form default - can't edit existing records, can create new record, can switch to edit (1 Viewer)

Kyrgyzstanart

New member
Local time
Today, 13:40
Joined
Jun 1, 2009
Messages
2
Hello Access Gurus,

I am really new to Access. Using 2007 version of the application. I created my tables and relationships, and some forms to be able to edit and enter new information in my DB.

I noticed that when I open a form w/ an existing record on it - it's very easy to make a mistake and change a record somewhat. I want to avoid as much as possible this accidental change of the record, but allow creation of a new record AND intentional editing of the existing ones.

Here is my idea:

- When the form is opened, the user has "read-only" access by default to all of the controls on that form;
- then if the user needs to edit the record he/she would press a button that will switch the form for the record to the "read-write" mode;
- then when the user goes to the next existing record the form automatically goes back to the default state ("read-only") and if the user needs to change it too he/she will have to press that "read-write" button again;
- then if the user needs to create a new record he/she presses another button that opens a new record in "read-write" mode.

I guess all of the above will need to be done through a macro, it's just that since I am new to Access I don't know what code I will need...

Could anybody help me, please?

Greatly appreciated!
 

SOS

Registered Lunatic
Local time
Today, 04:40
Joined
Aug 27, 2008
Messages
3,514
Set the form's AllowAdditions property to YES and the AllowEdits property to NO. Then you can have a button to enable the editing and in the click event (remember to put it in the VBA window and not the event property), you can put:

Me.AllowEdits = True

and then in the form's On Current event you can use:

Me.AllowEdits = False

to relock it.
 

carlos.moyaq

New member
Local time
Today, 04:40
Joined
May 10, 2012
Messages
2
I have a similar problem, I´m adding a search button into my form but every time I click it, it add a new register. So I wrote:

private sub BUTTONSNAME_click ()
me.allowadditions=false
end sub

It does chage de "allowadditions" property to NO, but not before adding a new registry when clicked by the first time. Any idea? I´m guessing it is updating the whole thing before doing what I asked, but don't know how to avoid it
 

Users who are viewing this thread

Top Bottom