Help with command buttons

lushh

Registered User.
Local time
Tomorrow, 06:20
Joined
Jul 19, 2006
Messages
34
hello.. i want my form to look like this:

employeeform.jpg


where there is add, edit, save and delete buttons.. and that the record cannot be edited unless the "Edit button" is clicked and the entry will only be saved when the "Save" button is clicked. i tried to search for sample databases, but it doesn't inlcude a sample of this. thank you so much...
 
Are you sayning that you want to just add a buch of buttons to your form? If so use the button wizzard!
 
i already used button wizard. currently, i have add, save, delete, but there is no edit in button wizard.. and i also want to remove the auto save feature of access.. it should only edit and save records when edit and save buttons are clicked... thanks...
 
OK, do you want to edit the information on the current form or on another form? If you want to edit the information on another form yiu just need to make the button an 'Open Form' event from the wizzard and change its name to Edit.

If its on the current form I can't see why you would want an Edit button!
 
ddrew said:
OK, do you want to edit the information on the current form or on another form? If you want to edit the information on another form yiu just need to make the button an 'Open Form' event from the wizzard and change its name to Edit.

If its on the current form I can't see why you would want an Edit button!

i need the edit button so that the records will be more secure. what if someone accidentally deleted a data? it will be automatically saved right? but if the form has an edit button, you will need to click the edit button first before you can make some changes then save it. got it?
 
Ok then maybe an optionis to lock all of the text boxes and then when you click the button it unlocks them!
 
Or you could have a separate form that contains your buttons, which then lead to different sub-forms depending upon the action to be taken. In this manner, you can control what a user can do on each form, rather than trying to let them do all the jobs on the same form by clicking the buttons.

I'm currently putting the finishing touches to a database for work which does this sort of thing, so feel free to take a look at my example and see if it is of any use to you.

On the ADD form, try starting a new record, then using the Save, Delete, Add, and Main Menu buttons to get an idea of how they work.
On the VIEW form, you'll notice that I have locked off certain fields, such that when a new record has been entered it becomes impossible to delete without going into Access proper and editing the table. Bear in mind that the 'Create Form' button on this form will not work properly, since you don't have the templates I use on your PC.

You expressed concern about general security. On my live copy, the button on the Switchboard to return to Access is much smaller, invisible, and sits in the extreme bottom left of the Switchboard. In this manner, any user who doesn't know about my secret access button can't get into the Access program behind (and no, they can't use the Shift whilst opening trick either (look at the database's Modules and you'll see why)).
 

Attachments

Last edited:
ddrew said:
How about this then!

A nice idea, but only works with unbound fields, which may cause lushh a problem; especially when it comes to fields - such as dates - that require strict input masks.

Better to manipulate the AllowEdits variable for the whole form, rather than the Locked variable for each field, by using the code:


Private Sub btnEdit_Click()
Me.btnLock.Visible = True
Me.btnLock.SetFocus
Me.btnEdit.Visible = False
Me.AllowEdits = True
End Sub

Private Sub btnLock_Click()
Me.btnEdit.Visible = True
Me.btnEdit.SetFocus
Me.btnLock.Visible = False
Me.AllowEdits = False
End Sub

Private Sub Form_Open(Cancel As Integer)
Me.AllowEdits = False
End Sub


In this way, you can also use the 'Me.AllowDeletions' and 'Me.AllowAdditions' options to supress/allow those variables...

...or you could just use the individual form method I posted. Either way works, so it's really up to lushh's requirements.
 
Last edited:
hi guys.. thanks for the replies... i do appreciate them... it really did help.. sorry for the inconvenience.. have a great day.. God bless... =)
 

Users who are viewing this thread

Back
Top Bottom