Solved

open query from code - restore window

Posted on 2009-07-07
14
471 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:titorober23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 24797797
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
 

Author Comment

by:titorober23
ID: 24802775
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24808029
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:titorober23
ID: 24812560
No there is not code behind that will maximized it, thanks
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24814703
Can you post a small sample that exibits this issue?
0
 

Author Comment

by:titorober23
ID: 24839320
DoCmd.OpenQuery sql, acViewNormal, acReadOnly

where sql is the name of the query
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24841518
I meant a sample database...
0
 

Author Comment

by:titorober23
ID: 24849549
what do you mean sample data, it is a query with 10 fields, i just need it to open not maximized
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24850687
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
 

Author Comment

by:titorober23
ID: 24850985
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
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 24851819
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
 

Accepted Solution

by:
titorober23 earned 0 total points
ID: 24851871
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24852019
<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
 

Author Comment

by:titorober23
ID: 24852299
well, i can work with the maximized query, i mean it is not a big deal, thanks for all your time and help
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question