Are 2 forms required for new entries and edits

chrisjames25

Registered User.
Local time
Today, 02:51
Joined
Dec 1, 2014
Messages
404
Hi I'm embarking on my first database and hoping to learn as i go.

My first query is on forms and new entries.

I have a form for inputting Crisp Brands. On the form is a Txt_box for entering the crisp brand an unbound txt box for renering the text box to ensure spelling is correct and a lst_box listing all existing crisp brands in the sytem.

First question is:

1) When i open the form i only want to be able to add new entries and not be able to edit old entries. However i would like some people to have the ability to edit existing ones. Is it best to create two forms one for new entries adn one for editing or is it best to add a command button on form for editing.

2) how do i achieve new entries only?

MAny thanks
 
Hello chrisjames25, you can use the same form to get this sorted. There is a property called as "Data Entry", which if set will only allow the Form to be opened to add new records, setting the same property will allow the form to Edit/Add/Delete data. Although all of this could also be restricted by changing the proprieties in Design view.

However if you want to open the Form using VBA, there is an argument DataMode, which takes in various arguments like acFormAdd, acFormEdit, acFormPropertySettings and acFormReadOnly.

So when a Form is opened, if the person has authorisation the argument could be changed. Something like,
Code:
If allowAccess = True Then
    DoCmd.OpenForm "yourFormName", DataMode:= acFormEdit
Else
    DoCmd.OpenForm "yourFormName", DataMode:= acFormAdd
End If
I have assumed that allowAccess is the flag that determines if the Form needs to be opened as Edit or Addition.
 
sometimes it does make sense to have different forms, although as Paul indicated, forms can easily be multi-use
 

Users who are viewing this thread

Back
Top Bottom