Solved

open query from code - restore window

Posted on 2009-07-07
14
464 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

758 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

20 Experts available now in Live!

Get 1:1 Help Now