AllowLayoutView

the owner of the shop, opens and uses the forms like other staffs. But one day he decides he needs to change the size of a text box or some other minor changes in form design. He wants to be able to right click the form and select layout view and change the design of the form
so what happens when the business grows and the owner buys a second computer?

He knew I'm in collage and studying databases and asked me if I can find a way to allow him having access to layout view (only him).
just to be clear - you are not writing the app for him, the owner has written his own app and knows what he is doing, he's just asked you 'if there is a way' to switch to layout view whilst in normal view.

Suggest you provide him with a link to this thread
 
Here's another possibility to consider which was I think mentioned earlier in passing:
Let's say the form to be opened is called frmContactInfo and the function to check user permissions is called GetAccessLevel

Create a calling form with two buttons as shown below:
1614451336855.png


Now add the following code to the form:
Code:
Private Sub cmdOpenForm_Click()
    DoCmd.OpenForm "frmContactInfo", acNormal
End Sub

Private Sub cmdOpenFormLayout_Click()

    'only available to admin users
    DoCmd.OpenForm "frmContactInfo", acLayout
End Sub

Private Sub Form_Load()

    'modify the properties of form frmContactInfo according to permission level
    
    'iden form in design view & hidden
    DoCmd.OpenForm "frmContactInfo", acDesign, , , , acHidden

    Select Case GetAccessLevel
    
    Case 1 'standard user
        Forms!frmContactInfo.Form.AllowLayoutView = False
        Me.cmdOpenFormLayout.Enabled = False
    Case 2 'admin
        Forms!frmContactInfo.Form.AllowLayoutView = True
        Me.cmdOpenFormLayout.Enabled = True
    End Select
    
    'close hidden form & save changes
    DoCmd.Close acForm, "frmContactInfo", acSaveYes
    
End Sub

This automatically configures form frmContactInfo depending on user level. The user never sees the changes being done as that form is opened in design view and hidden, modified as appropriate, saved and closed again.

The button to open in layout view is disabled for standard users. If preferred the button could be hidden instead
 

Users who are viewing this thread

Back
Top Bottom