Solved

open query from code - restore window

Posted on 2009-07-07
14
470 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
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

809 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