98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Access CloseButton
Access CloseButton
Resolved · High Priority · Version 2003
David has attended:
Access VBA course
Access CloseButton
Hi
I've tried using the following code to disable the close button on form open:
Private Sub Form_Open(Cancel As Integer)
Me.CloseButton = False
End Sub
But I get the following error when opening the form:
Run-time error '2448':
You can't assign a value to this object.
I don't understand why you can't assign a value as the VB Editor offers you True/False as a value after you've typed the equals sign.
Thanks
David
RE: Access CloseButton
Hi David
Thanks for your question
Try:-
me.closebutton.enabled = false
This sets the enables property of the command button to false. A command button has no value property which is why your code didn't work
Regards
Stephen
RE: Access CloseButton
Thanks for coming back to me Stephen. I've tried that and now get an error in VB stating:
Compile error:
Invalid qualifier
and .CloseButton is highlighted out of that line of text.
Thanks
David
RE: Access CloseButton
Hi David
Thanks for getting back to me.
I was assuming that closebutton was the name you had given to that control. If that is not the case then changing closebutton to the correct name might fix the problem.
If closebutton is the correct name then could you tell me what the error number is
Regards
Stephen
RE: Access CloseButton
Hi Stephen
No its not a control that I've set up, its the window (form) close button.
If I use Me.CloseButton.Enabled = False I get Compile Error: Invalid qualifier.
If I use Me.CloseButton = False I get error 2448, You can't assign a value to this object.
Thanks
David
RE: Access CloseButton
Hi David
Sorry for the delay.
The control button should have a name property. You can find this in the properties sheet. If you use that name rather than close button, this should solve the problem.
Regards
Stephen
Mon 5 Apr 2010: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Modal formsIf you have created a form / switchboard and dont want people to get away from using the switchboard, you can change the form properites for Modal to On. |