access closebutton
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Access CloseButton

Access CloseButton

resolvedResolved · High Priority · Version 2003

replyReply Thu 18 Mar 2010, 14:41Delegate David said...

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

For upcoming training course dates see: Pricing & availability

replyReply Thu 18 Mar 2010, 15:27Trainer Stephen said...

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

replyReply Thu 18 Mar 2010, 15:30Delegate David said...

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

replyReply Mon 22 Mar 2010, 12:18Trainer Stephen said...

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

replyReply Tue 23 Mar 2010, 07:45Delegate David said...

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

replyReply Mon 29 Mar 2010, 15:10Trainer Stephen said...

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.

 

Please browse our web site to find out more about
access.training and other Microsoft training courses.

Access tip:

How To Find All Overdue Accounts?

To find overdue accounts create a filter that compares today's date with the Invoice Date in the table. To do this:

1. Open the Query in Design View
2. Select the field for the filter and in the criteria row enter:

<Date()

This filter returns records where the Invoice Date is before today's date.

This filter can be manipulated if, for instance, Invoices are due 15 days after the Invoice Date. For this the filter would be:

<Date()-15

This filter returns records where the Invoice Date is 15 days before today's date.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard