form size on openform

F

Fredrated

If I issue a docmd.openform "FormName", the form opens in the same size mode
(full size or resized) as the form that opens it, whether I want it to or
not. I usually solve this by setting popup=yes in the form that I am opening
and it opens in the smaller size no problem. However, I have discovered a
pecularity about popup=yes. If I place a search button on the called (popup)
form, then use the button to conduct a search, the drop-down labeled "Look
In" has the name of the field the cursor was in, this is normal, but then the
second option on the 'look-in' list is the original calling form, not the
form where the search button resides!

For ex., if form 'fStudent' runs DoCmd OpenForm "fSearchMe", and fSearchMe
has a wizard-added search button, the form opened by the search button has a
'look in' list of
lastname
fStudent

instead of

lastname
fSearchMe

(I had to do it this way because, due to problems with connecting the Access
form to a postgreSQL table with ODBC, the form fStudent had to be an unbound
form).

Anyway, to make a long story longer, how do I get the form fSearchMe to open
in the smaller size, not full screen, when I open it, without using popup=yes?

Thanks in advance for any help.

Fred
 
F

fredg

If I issue a docmd.openform "FormName", the form opens in the same size mode
(full size or resized) as the form that opens it, whether I want it to or
not. I usually solve this by setting popup=yes in the form that I am opening
and it opens in the smaller size no problem. However, I have discovered a
pecularity about popup=yes. If I place a search button on the called (popup)
form, then use the button to conduct a search, the drop-down labeled "Look
In" has the name of the field the cursor was in, this is normal, but then the
second option on the 'look-in' list is the original calling form, not the
form where the search button resides!

For ex., if form 'fStudent' runs DoCmd OpenForm "fSearchMe", and fSearchMe
has a wizard-added search button, the form opened by the search button has a
'look in' list of
lastname
fStudent

instead of

lastname
fSearchMe

(I had to do it this way because, due to problems with connecting the Access
form to a postgreSQL table with ODBC, the form fStudent had to be an unbound
form).

Anyway, to make a long story longer, how do I get the form fSearchMe to open
in the smaller size, not full screen, when I open it, without using popup=yes?

Thanks in advance for any help.

Fred

Look up the MoveSize method in VBA help.
Code the form's Loadevent

DoCmd.MoveSize , , 2*1440, 1*1440

to size the form to 2" wide by 1" tall.
Note all measurements are in Twips, 1440 per inch.
 
F

Fredrated

fredg said:
Look up the MoveSize method in VBA help.
Code the form's Loadevent

DoCmd.MoveSize , , 2*1440, 1*1440

to size the form to 2" wide by 1" tall.
Note all measurements are in Twips, 1440 per inch.

Thanks for trying, but the form still opens in a full screen.
BTW, Access help says "Each measurement is in inches or centimeters,
depending on the regional settings in Windows Control Panel."
 
F

fredg

Thanks for trying, but the form still opens in a full screen.
BTW, Access help says "Each measurement is in inches or centimeters,
depending on the regional settings in Windows Control Panel."

That's what Access help may say, but did you read VBA help on the
MoveSize method as I had suggested?

From the Remarks part of VBA help on the MoveSize method:

"The units for the arguments are twips."

That's why I wrote 2*1440 and 1* 1440.
I could have used 2880,1440 just as well, but that would have meant
you would need to do the math to compute twips instead of Access.

Try:
DoCmd.Restore
DoCmd.MoveSize , , 2*1440,1*1440

If you wish to then return to maximized after closing this form, write
DoCmd.Maximize
in the Form's Close event.
 

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