Link to home
Start Free TrialLog in
Avatar of dailymeat
dailymeat

asked on

Autocenter does not work in Access 2003

i am trying to autocenter in the screen my forms in Access 2003. I tried setting the property to yes, I tried VBA code Me.Autocenter=True and it gives me an error "Run-time error 2448 You can't assign a value to this object"
SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dailymeat
dailymeat

ASKER

Thank you.

Gustav , the form does not center when I set the property to yes in the Access window, and if I use VBA code Me.Autocenter=True it gives me an error "Run-time error 2448 You can't assign a value to this object"

Scott,  this I tried https://msdn.microsoft.com/en-us/library/office/ff821162(v=office.14).aspx and that's how I get "Run-time error 2448 You can't assign a value to this object"

I tried http://www.peterssoftware.com/ci.htm before and it does not work right in the subforms.
If it is a specific form, then recreate it from scratch bit by bit and notice which setting will disable then Autocenter property.
Scott,  this I tried https://msdn.microsoft.com/en-us/library/office/ff821162(v=office.14).aspx and that's how I get "Run-time error 2448 You can't assign a value to this object"
Do you mean when setting this IN DESIGN VIEW that you get that error? If so, then heed Gustav's advice about recreating your form. You might also consider performing maintenance on the database as well (i.e. compact, compile, etc).
Thank you.

Gustav, Is not a specific form I have around 50.

Scott, I get the message when I tried to open it in form view. The .mdb is set to compact on close, I do compiling often.
Did you read my comment here:

From the Help article:

   
You can set this property only in Design view.


https://msdn.microsoft.com/en-us/library/office/ff821162(v=office.14).aspx

This means you CANNOT do this at runtime. You must open the form in Design view, set the AutoCenter property in the Properties dialog, and then close and save the form.

Side Note: Compact on Close is generally not necessary in a properly deployed database. You should always use a "split" architecture, where you have a Backend (Tables only) and a FrontEnd (everything else). If you do, then compact on close will only affect the FE, which is not the one you worry about.
Still does not center the form
What does "still" mean? Did you set the property in Design View?

Scott is right. Any attempt to set the property in other view will raise an error.
I think I am confused, what I want to achieve is when I open a form that the form is centered in the window, NOT on the top left hand side of the window. So by writing VBA code on the "open" event in design view Me!autocenter=True, I thought that when I open the form in form view it would be centered in the window no matter the size of the window.
I don' think you are confused, it just appears not to be possible that way.

The method I have used, is to use the Move method of the form after having opened it. Trouble is, that you first have to find out how many units to move it.
You can't use code to do this, as we've mentioned several times. You MUST use the Properties dialog to do this with the Form in Design View:

User generated image
I have set that property to yes and nothing happens
Gustav, Scott

I found out why the auto center property was not working, I had a command to Maximize the form, thank you for your help.

How do I  divide the points 50/50?
Glad you got things sorted.

Here's a link to a Help page that may help you close out your question: http://support.experts-exchange.com/customer/portal/articles/608596