Solved Opening a Form in Edit/Add Mode (1 Viewer)

Pac-Man

Active member
Local time
Today, 20:29
Joined
Apr 14, 2020
Messages
416
Hello,

This is general question which I want to implement into my database. Can I setup my form so that it opens in Add mode (blank form so that people can't go back to previous records) normally but there may be any alternate method of opening it in edit mode (user can go to previous records to make edits) without having to go to design mode.

PS. Navigation buttons are disabled on the form. I can define new navigation buttons (by adding commands button). I also read somewhere that controls can be set to hidden in add mode and visible in edit mode.

Best Regards,
Abdullah
 

isladogs

MVP / VIP
Local time
Today, 16:29
Joined
Jan 14, 2017
Messages
18,247
Yes you can do all the above
Open your form in add mode using
Code:
DoCmd.OpenForm "YourFormName",,,,acFormAdd
The built in navigation buttons are automatically disabled in that mode.

However if you want to create your own buttons, you can control whether visible or hidden using the Tag property. See Set Controls.
If you want that related to using Add/Edit mode, use the form's OpenArgs property in conjunction with Tag
 

Micron

AWF VIP
Local time
Today, 11:29
Joined
Oct 20, 2018
Messages
3,478
You can also pass an opening argument to the Open event of a form, and that argument can represent any mode you define yourself. Then based on that mode, you can open the form in one of the built in standard modes as noted, or customize your own. Suppose the user's permissions are such that they are not allowed to add or edit records. Then you can either lock/disable all controls, or perhaps just some, or you might change the form record source property to a snapshot query, which would automatically disable editing. Or a form might need to be opened with just one or two controls enabled if the record has a particular status. If you can think it, you can probably do it in Access.

EDIT - sorry, isladogs. Didn't see your OpenArgs point until I posted. It's too early here for me.
 

Pac-Man

Active member
Local time
Today, 20:29
Joined
Apr 14, 2020
Messages
416
Dear @Micron and @isladogs, thank you very much for replies. I've got the point and I'll implement it in my database at final stage. I wanted to have one form in which user can add date and same form by which database administrator can modify, delete data. Thanks again.
 

Users who are viewing this thread

Top Bottom