don't want users to be able to change data unless they have pushed a button

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Dear all,

I'm creating a database (for making invoices) with several forms based on
several tables and queries.

My goal is the following:

I want to protect the data on the forms (or more correct: of the underlying
tables) against accidentally changing.

I have created the database for different users and some of them might change
data without wanting to change anything.

I have therefor set the properties of all forms as follows:
allow edits = No
allow deletions = Yes
allow additions = No
Data Entry = No

I have also provided for several command buttons on the forms.

Goal is that people can only add data when they push the command button "add"
and that they can only edit data when they push an edit button.

After having edited or added data they should push a save button.

People must also be able to save a record when they have only filled in (when
adding a new record or changing an existing record) some of the data fields
on the form.

If I may I'll write down the code for the different command buttons.

Maybe you could tell me if they're correct?

COMMAND BUTTONS

For each button there's:

Private Sub ... CliCk()
On Error GoTo Err_..._Click

CODE (SEE AFTER PLEASE)

Exit_..._Click:
Exit Sub

Err_..._Click:
MsgBox Err.Description
Resume Exit_..._Click

End Sub

I guess this was classic, but now code itself

1) ADD (this button works fine)

Me.AllowAdditions=True

DoCmd.GoToRecord, ,acNewRec

[...].SetFocus

2) DELETE (this button does not work)

DoCmd.DoMenuItem acFormBar,acEditMenu,8 ,acMenuVer70
DoCmd.DoMenuItem acFormBar,acEditMenu,6 ,acMenuVer70

3) EDIT (works)

Me.AllowEdits=True

[...].SetFocus

4) Save (works after editing, but not after adding)

If Me.Dirty Then Me.Dirty= False

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,acMenuVer70

[...].SetFocus

Problem with the buttons above:

1) After having edited a record the record is saved when using the button
save.

But after adding a new record the record is not saved: there's following
error message "the command or action 'SaveRecord' isn't available now.

One more detail about saving: when I use the close button after editing or
adding a record the data is always saved.

The button "save"thus only partially work.


2) Also the command button "delete record" does not work. When pushing the
button, there no error message, but nothing happens.


Kind regards and many thanks for help already,

Bert

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200901/1

.



Relevant Pages

  • Re: does textpattern have a forum for discussing issues?
    ... I moved the files and the database but I'm still ... I've looked through the code and I found that this error message is ... TextPattern have anything similar? ... To find a page (in order to edit it) they had to negotiate a series ...
    (comp.lang.php)
  • Re: Duplicating Multiple records in a form
    ... And in reality, despite it being not good normalized database process, ... It sounds like you are trying to do something (select multiple records, ... At present I can select multiple records and using the Edit Menu, ... command, I can copy these records and then use the Edit Menu, Paste ...
    (microsoft.public.access.formscoding)
  • Re: does textpattern have a forum for discussing issues?
    ... I moved the files and the database but I'm still ... getting an error message: ... I rebuilt a site that once ran on Textpattern. ... To find a page (in order to edit it) they had to negotiate a series ...
    (comp.lang.php)
  • Re: [SLE] MySQL Table Locked?
    ... I tried to edit the table again, ... Run this command from the commandline as root: ... I'll describe the basic structure of my database, ... >> Check the headers for your unsubscription address ...
    (SuSE)
  • Re: does textpattern have a forum for discussing issues?
    ... I moved the files and the database but I'm still ... getting an error message: ... TextPattern have anything similar? ... To find a page (in order to edit it) they had to negotiate a series ...
    (comp.lang.php)