problem editing

smoker

New member
Local time
Yesterday, 23:58
Joined
Jun 17, 2005
Messages
9
i created a database to place in order my movies collection with 4 fields in a form. the problem is that when i use the form, and accidently change a record and after that i exit the database, it saves the changes. i would like to know what i can do so it won't keep the changes except if i press the save button on the form and also allow me to add more records ( i tried to lock the field but after that i couldn't add any records...). i am not much of access user so please be as descriptive as possible.thank you all!
 
smoker,

You have a couple of choices.

First, when you launch your form, you can choose to set it to
read-only. Then, you won't have to worry about it. You can
selectively launch it with full read/write permissions when
you want to edit.

Or you can read up on the events that Access uses when it runs
your forms. You can intercept the action (like a record update)
and flat-out cancel it, or you can ask whether to save the data
or not. This route is a lot more flexible, and a lot more work.

I'd use the first method for starters.

DoCmd.Openform "YourForm",acNormal,,,acFormAdd
DoCmd.Openform "YourForm",acNormal,,,acFormEdit
DoCmd.Openform "YourForm",acNormal,,,acFormReadOnly

Wayne
 
Wayneryan,

thanks for the information. first i would like to ask you where i have to write those comands (in wich field) and second, how can i add a "edit button" on my form?i was lookig for an edit comand but i cant find one with the wizard. i use access 2003. and also, can you tell me where i should look for some information about the events that Access uses when i run my form and how to You can intercept the actions? thanks again :)
 
can you tell me where i should look for some information about the events that Access uses

All the info you require for starters can be found in Access Help.
Read the info first, come back if you still feel the need to.

RV
 
The events are located under the properties of each control and form in the Events tab. You can write code behind those to add the lines:
DoCmd.Openform "YourForm",acNormal,,,acFormAdd
DoCmd.Openform "YourForm",acNormal,,,acFormEdit
DoCmd.Openform "YourForm",acNormal,,,acFormReadOnly
 
thanks for the replies but the commands you gave me were already in my form. i fixed the problem adding those lines under current event in my form :

If Me.NewRecord Then
Me.AllowEdits = Yes
Me.AllowDeletions = Yes
Else
Me.AllowEdits = No
Me.AllowDeletions = No
End If

another question for you is how can i create an edit button on my form, because i can't find one wih the wizard. what i need is, when i click on the button to allow me to edit my records automatically because such thing is now impossible except if i changes the commands and so on. if you have any idea tell me. thanks
 

Users who are viewing this thread

Back
Top Bottom