Change the Window Size in Access

P

Pierre

I have read the post (Change the Window Size in access:dated 6/16/2006) and
attempted to follow the instruction on the link listed to change the Access
Window size. Now I'm not sure if there was something else I should have
done. But I'm getting a Complie error: Variable not defind;
the text "HWND_TOP" is now highlighted on line (below) of the code.
'LINE
SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _

Does anyone have any idea of why I would have gotten this error.




Check this link

http://support.microsoft.com/kb/210085
 
D

Douglas J. Steele

The error message implies that you didn't define that constant.

Did you remember to copy the line

Global Const HWND_TOP = 0

from the KB article?
 
P

Pierre

Ty - I didn't forget to TYPE it. I just TYPED it in wrong. But with that
being said. I went over and attempted to read everything word for word. I
am now getting a new Compile error of: Wrong number of arguments or invalid
property assignment.
The text "SetWindowPos" is now highlighted on LINE

SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _


NOTE: B/c I’m working on two deferent systems. I can't copy and paste the
information from the web. FAT Fingering may be the issue, so I had someone
else look over it to make sure.
 
D

Douglas J. Steele

Copy and paste your exact code so that a second pair of eyes can look at it
(or, perhaps easier, copy from the web page and paste into your module. I
just did that, and the code worked fine for me)
 
P

Pierre

I seemed to have jumped the gun - Although Opening the Immediate windown and
typing the sxample given, it worked. I then saved the Module as Module1 and
closed out Access completely. After re-opening it did not change the size to
the form. Was I suppose to do something else to get it to size to the form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes; Has
Module.Yes -AND- Allow Design Changes.All Views
 
D

Douglas J. Steele

I'm not sure I'm following you.

That code is temporary: you need to run it each time you open the database.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
I seemed to have jumped the gun - Although Opening the Immediate windown
and
typing the sxample given, it worked. I then saved the Module as Module1
and
closed out Access completely. After re-opening it did not change the size
to
the form. Was I suppose to do something else to get it to size to the
form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes; Has
Module.Yes -AND- Allow Design Changes.All Views

--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
Copy and paste your exact code so that a second pair of eyes can look at
it
(or, perhaps easier, copy from the web page and paste into your module. I
just did that, and the code worked fine for me)
 
P

Pierre

is it possible to place this code on the ON OPEN properties of the form so
that it adjust to the size of the open form (all of my forms are the same
size). At best just change to as size that I would like and I make all forms
(Maximize) to window.
--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
I'm not sure I'm following you.

That code is temporary: you need to run it each time you open the database.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
I seemed to have jumped the gun - Although Opening the Immediate windown
and
typing the sxample given, it worked. I then saved the Module as Module1
and
closed out Access completely. After re-opening it did not change the size
to
the form. Was I suppose to do something else to get it to size to the
form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes; Has
Module.Yes -AND- Allow Design Changes.All Views

--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
Copy and paste your exact code so that a second pair of eyes can look at
it
(or, perhaps easier, copy from the web page and paste into your module. I
just did that, and the code worked fine for me)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ty - I didn't forget to TYPE it. I just TYPED it in wrong. But with
that
being said. I went over and attempted to read everything word for
word.
I
am now getting a new Compile error of: Wrong number of arguments or
invalid
property assignment.
The text "SetWindowPos" is now highlighted on LINE

SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _


NOTE: B/c I'm working on two deferent systems. I can't copy and paste
the
information from the web. FAT Fingering may be the issue, so I had
someone
else look over it to make sure.
 
D

Douglas J. Steele

Yes, that's the way to do it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
is it possible to place this code on the ON OPEN properties of the form so
that it adjust to the size of the open form (all of my forms are the same
size). At best just change to as size that I would like and I make all
forms
(Maximize) to window.
--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
I'm not sure I'm following you.

That code is temporary: you need to run it each time you open the
database.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
I seemed to have jumped the gun - Although Opening the Immediate windown
and
typing the sxample given, it worked. I then saved the Module as
Module1
and
closed out Access completely. After re-opening it did not change the
size
to
the form. Was I suppose to do something else to get it to size to the
form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes; Has
Module.Yes -AND- Allow Design Changes.All Views

--
Work is sometimes hard....but someone has to do it.


:

Copy and paste your exact code so that a second pair of eyes can look
at
it
(or, perhaps easier, copy from the web page and paste into your
module. I
just did that, and the code worked fine for me)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ty - I didn't forget to TYPE it. I just TYPED it in wrong. But
with
that
being said. I went over and attempted to read everything word for
word.
I
am now getting a new Compile error of: Wrong number of arguments or
invalid
property assignment.
The text "SetWindowPos" is now highlighted on LINE

SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _


NOTE: B/c I'm working on two deferent systems. I can't copy and
paste
the
information from the web. FAT Fingering may be the issue, so I had
someone
else look over it to make sure.
 
P

Pierre

I get a expression ON OPEN error: Only comments may appear after End Sub, End
Founction, or End Property.

Going back to MVB, I click Compile db1 and the complete Delare Sub
SetWindowPos....-to- ByVal wFlags& is Highlighted.
I'm not sure of what changes (if any) has to be done at this point. Any
recommendations
--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
Yes, that's the way to do it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
is it possible to place this code on the ON OPEN properties of the form so
that it adjust to the size of the open form (all of my forms are the same
size). At best just change to as size that I would like and I make all
forms
(Maximize) to window.
--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
I'm not sure I'm following you.

That code is temporary: you need to run it each time you open the
database.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I seemed to have jumped the gun - Although Opening the Immediate windown
and
typing the sxample given, it worked. I then saved the Module as
Module1
and
closed out Access completely. After re-opening it did not change the
size
to
the form. Was I suppose to do something else to get it to size to the
form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes; Has
Module.Yes -AND- Allow Design Changes.All Views

--
Work is sometimes hard....but someone has to do it.


:

Copy and paste your exact code so that a second pair of eyes can look
at
it
(or, perhaps easier, copy from the web page and paste into your
module. I
just did that, and the code worked fine for me)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ty - I didn't forget to TYPE it. I just TYPED it in wrong. But
with
that
being said. I went over and attempted to read everything word for
word.
I
am now getting a new Compile error of: Wrong number of arguments or
invalid
property assignment.
The text "SetWindowPos" is now highlighted on LINE

SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _


NOTE: B/c I'm working on two deferent systems. I can't copy and
paste
the
information from the web. FAT Fingering may be the issue, so I had
someone
else look over it to make sure.
 
D

Douglas J. Steele

What exactly did you do?

The code from the KB article should exist only in your module (Module1),
nowhere else.

There are two different ways in which you can use it

One is to set the On Open property of the form to [Event Procedure] and use
the following VBA:

Private Sub Form_Open(Cancel As Integer)

Call SizeAccess(0,0,480,640)

End Sub

The other is to set the On Open property to =SizeAccess(0,0,480,640)

Note that you must include the equal sign in this second approach.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
I get a expression ON OPEN error: Only comments may appear after End Sub,
End
Founction, or End Property.

Going back to MVB, I click Compile db1 and the complete Delare Sub
SetWindowPos....-to- ByVal wFlags& is Highlighted.
I'm not sure of what changes (if any) has to be done at this point. Any
recommendations
--
Work is sometimes hard....but someone has to do it.


Douglas J. Steele said:
Yes, that's the way to do it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Pierre said:
is it possible to place this code on the ON OPEN properties of the form
so
that it adjust to the size of the open form (all of my forms are the
same
size). At best just change to as size that I would like and I make all
forms
(Maximize) to window.
--
Work is sometimes hard....but someone has to do it.


:

I'm not sure I'm following you.

That code is temporary: you need to run it each time you open the
database.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I seemed to have jumped the gun - Although Opening the Immediate
windown
and
typing the sxample given, it worked. I then saved the Module as
Module1
and
closed out Access completely. After re-opening it did not change
the
size
to
the form. Was I suppose to do something else to get it to size to
the
form.

NOTE: My form properties [other] are set to Pop up.NO; Modal.Yes;
Has
Module.Yes -AND- Allow Design Changes.All Views

--
Work is sometimes hard....but someone has to do it.


:

Copy and paste your exact code so that a second pair of eyes can
look
at
it
(or, perhaps easier, copy from the web page and paste into your
module. I
just did that, and the code worked fine for me)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ty - I didn't forget to TYPE it. I just TYPED it in wrong. But
with
that
being said. I went over and attempted to read everything word
for
word.
I
am now getting a new Compile error of: Wrong number of arguments
or
invalid
property assignment.
The text "SetWindowPos" is now highlighted on LINE

SetWindowPos h, HWND_TOP, cX, cY, cY, cWidth, _


NOTE: B/c I'm working on two deferent systems. I can't copy and
paste
the
information from the web. FAT Fingering may be the issue, so I
had
someone
else look over it to make sure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top