Solved

open query from code - restore window

Posted on 2009-07-07
14
465 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
 

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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 4 45
Dropdown Not In List - not working correctly 11 35
VBA code won't run Delete Query 5 17
subform is not filtered by link field 8 14
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

914 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now