open query from code - restore window

Hi Guys

I am using this vb code
DoCmd.OpenQuery sql, acViewNormal, acReadOnly
to open a query, but it opens maximized, i would like to open it in a restore size(no minimized, no maximized), also is there any way to open in a Dialog mode, so user has to close it before going some place else

Please advice
titorober23Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
titorober23,

If you have Access 2007 set up to open in "Tabbed Windows", this is not possible.

You will have to change the Window Option in Access to open in "Overlapping Windows"

Office Button-->Access Options-->Current Database-->Document Window Options.
...Then check On the checkbox for Overlapping Windows Overlapping Windows.

;-)

JeffCoachman
0
titorober23Author Commented:
I do not need a tabbed window, and the overlaping option opens it maximized, i need to open a new window  as popup window, that i can see what is in the background
0
Jeffrey CoachmanMIS LiasonCommented:
When I open an Overlapping widow in Access 2007 it opens Restored (not maximized).
So I can't say that I know why this is happening to you.
(Are you sure there is no code on the form to maximize it on Open or Load?)

You can only open Forms and Reports as True "Pop-ups" (Dialog, Modal), not Tables or Queries.

JeffCoachman
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

titorober23Author Commented:
No there is not code behind that will maximized it, thanks
0
Jeffrey CoachmanMIS LiasonCommented:
Can you post a small sample that exibits this issue?
0
titorober23Author Commented:
DoCmd.OpenQuery sql, acViewNormal, acReadOnly

where sql is the name of the query
0
Jeffrey CoachmanMIS LiasonCommented:
I meant a sample database...
0
titorober23Author Commented:
what do you mean sample data, it is a query with 10 fields, i just need it to open not maximized
0
Jeffrey CoachmanMIS LiasonCommented:
Again:,  Sample *DATABASE*.

I cannot replicate your issue.

If you post a sample of an actual database file that exibits the issue, it would help in troubleshooting.

JeffCoachman
0
titorober23Author Commented:
the database is too big.

this is the code line that i am using

DoCmd.OpenQuery sql, acViewNormal, acReadOnly

When i choose a query and then hit "Open query" it opens it but maximized, so i loose view of the main form

queryform.jpg
0
Jeffrey CoachmanMIS LiasonCommented:
If the Initial form is maximized, any subsequent Objects opened will also be Maximized.
So in your case the Main form is maximized, so anything you open while it is still maximized will also be maximized.

This is just the way Access works.

You can workaround this be making a Datasheet View Form from the query.
Then setting the "Pop-Up" Property of this new form to "Yes"
Then open the form with the "DS" (Datasheet View) option:
        DoCmd.OpenForm "Form1", acFormDS


Here is a sample

JeffCoachman

Access-EEQ-24549765OpenInitialMa.mdb
0
titorober23Author Commented:
yes, i thought about that, but i do not want to put more forms to my db, i also thought about  putting sql as a record source in the form and delete the query, but not sure

Thanks a lot
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
<i do not want to put more forms to my db>
Why not?

<putting sql as a record source in the form and delete the query>
Same problem would result...
:-(
0
titorober23Author Commented:
well, i can work with the maximized query, i mean it is not a big deal, thanks for all your time and help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.