UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Disable Control Box, Access 2016    
 
   
SallyCh
post Dec 2 2019, 05:56 AM
Post#1



Posts: 86
Joined: 24-October 14
From: UK


Hi all

I have a form that has various buttons to close it (Save & Close, Cancel & Close and Save & New)

When the form opens in form view, I want the Close Button or control box to be disabled. When it is opened as a Datasheet (in read only), I need the Close Button/Control Box to be enabled.

I've tried the following, but it still uses the settings on the Property Sheet.

Private Sub Form_Load()
If Me.CurrentView = 2 Then
Me.ControlBox = True

Else
Me.ControlBox = False

End If

If I try me.closebutton = true (or false), I get an error message.

Assistance would be gratefully received. notworthy.gif

Go to the top of the page
 
DanielPineault
post Dec 2 2019, 06:12 AM
Post#2


UtterAccess VIP
Posts: 7,008
Joined: 30-June 11



The close button property can only be set in design view. You would need to get into using APIs to disable such a button. See: https://www.fmsinc.com/microsoftaccess/star...reventclose.asp if you truly want to go down that road.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
isladogs
post Dec 2 2019, 06:14 AM
Post#3


UtterAccess VIP
Posts: 1,893
Joined: 4-June 18
From: Somerset, UK


You can't alter certain form properties in this way.
The workaround is to use your code and instruct Access how to open the form.

docmd.openform "FormName",acNormal
Or
docmd.OpenForm "FormName",acFormDS

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th December 2019 - 08:51 AM