473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to bring window to top

How do I bring a window (in this case a report) within Access to the top
using code? i.e. make the report viewable (this is after it has already
been opened of course)

Thanks,

Gord
Aug 31 '08 #1
9 6628
DoCmd.OpenReport "nameofreport", acViewPreview

Chris
Microsoft MVP
Gord wrote:
>How do I bring a window (in this case a report) within Access to the top
using code? i.e. make the report viewable (this is after it has already
been opened of course)
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #2
Thanks Chris

I had already used this line (using 'acViewReport' instead) previously but
had "assumed" that I couldn't use the 'OpenReport' command a second time
after a report was already open.

Works just fine though.

I have another question that just came to mind (since you're on-line at the
moment) if you have a minute.

In using VB with Access, does one always have to set the focus on a control
on a form before referring to it in code? Using regular VB6, you don't have
to and it's quite intuitive. I get an error with VB in Access that I can't
refer to a control that doesn't have the focus. If true, is there a better,
more accepted way of referring to controls on a form rather than having to
always set the focus first?

Thanks again.

Gord

"Chris O'C via AccessMonster.com" <u29189@uwewrote in message
news:89821b8199a8b@uwe...
DoCmd.OpenReport "nameofreport", acViewPreview

Chris
Microsoft MVP
Gord wrote:
>>How do I bring a window (in this case a report) within Access to the top
using code? i.e. make the report viewable (this is after it has already
been opened of course)

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #3
If you use the text property of a control in code, you have to set focus to
it first before reading it. If you use the value property (the default), you
don't have to set focus to it first.

if (me.textboxname.value = "east") then
'do something
else
'do something else
end if

or

if (me.textboxname = "east") then
'do something
else
'do something else
end if
Chris
Microsoft MVP
Gord wrote:
>Thanks Chris

I had already used this line (using 'acViewReport' instead) previously but
had "assumed" that I couldn't use the 'OpenReport' command a second time
after a report was already open.

Works just fine though.

I have another question that just came to mind (since you're on-line at the
moment) if you have a minute.

In using VB with Access, does one always have to set the focus on a control
on a form before referring to it in code? Using regular VB6, you don't have
to and it's quite intuitive. I get an error with VB in Access that I can't
refer to a control that doesn't have the focus. If true, is there a better,
more accepted way of referring to controls on a form rather than having to
always set the focus first?
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #4
Most people use the second example. Less typing.

Chris
Microsoft MVP
Chris O'C wrote:
>If you use the text property of a control in code, you have to set focus to
it first before reading it. If you use the value property (the default), you
don't have to set focus to it first.

if (me.textboxname.value = "east") then
'do something
else
'do something else
end if

or

if (me.textboxname = "east") then
'do something
else
'do something else
end if

Chris
Microsoft MVP
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #5
Thanks Chris.

A little odd but at least if the default is accessible without having to
always setfocus, then that will be a big help.

I'll leave you alone now.

Gord
"Chris O'C via AccessMonster.com" <u29189@uwewrote in message
news:89825a58e79a9@uwe...
If you use the text property of a control in code, you have to set focus
to
it first before reading it. If you use the value property (the default),
you
don't have to set focus to it first.

if (me.textboxname.value = "east") then
'do something
else
'do something else
end if

or

if (me.textboxname = "east") then
'do something
else
'do something else
end if
Chris
Microsoft MVP
Gord wrote:
>>Thanks Chris

I had already used this line (using 'acViewReport' instead) previously but
had "assumed" that I couldn't use the 'OpenReport' command a second time
after a report was already open.

Works just fine though.

I have another question that just came to mind (since you're on-line at
the
moment) if you have a minute.

In using VB with Access, does one always have to set the focus on a
control
on a form before referring to it in code? Using regular VB6, you don't
have
to and it's quite intuitive. I get an error with VB in Access that I
can't
refer to a control that doesn't have the focus. If true, is there a
better,
more accepted way of referring to controls on a form rather than having to
always set the focus first?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #6
Not really odd. Value and Text for a given control can be totally different.

If a textbox has, for instance, had ***gold*** entered into it and the user
moves to another control or saves the record, ***gold*** is now the control's
***Value***. If, at a later point in time, you re-enter the textbox and type
in ***silver*** but don't exit the control, that control's ***Value*** is
***gold*** but it's ***Text*** is ***silver*** which, under some
circumstances, could be useful to know.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1

Aug 31 '08 #7
"Linq Adams via AccessMonster.com" <u28780@uwewrote in
news:89831f54037a3@uwe:
Not really odd. Value and Text for a given control can be totally
different.

If a textbox has, for instance, had ***gold*** entered into it and
the user moves to another control or saves the record, ***gold***
is now the control's ***Value***. If, at a later point in time,
you re-enter the textbox and type in ***silver*** but don't exit
the control, that control's ***Value*** is ***gold*** but it's
***Text*** is ***silver*** which, under some circumstances, could
be useful to know.
That explanation deserves the Bronze Star for Valor. :-)
--
Bob Quintal

PA is y I've altered my email address.
** Posted from http://www.teranews.com **
Aug 31 '08 #8
On Aug 31, 4:55*pm, "Chris O'C via AccessMonster.com" <u29189@uwe>
wrote:
Most people use the second example. *Less typing.

Chris
Microsoft MVP
IIRC (I don't have the reference anymore so don't ask), Microsoft
advocated using .Value instead of relying on the default property of
the control based on the fact that they do not guarantee that the
current default property in a given version will be the same as the
default property in a future version. I think they even gave an
example where the default property changed from .Value to something
else from one version to another. Something like the second example
could fail, or worse assign a completely wrong value without giving
you any indication that something is wrong. Subsequently, I try to
include the .Value where appropriate. A bonus is that if IntelliSense
picks up the .Value in the list, you likely didn't spell the name of
the control incorrectly. Of course some people rely on the compiler
to discover that :-).

James A. Fortune
CD********@FortuneJames.com
Sep 1 '08 #9
On Aug 31, 9:26*pm, CDMAPos...@fortunejames.com wrote:
IIRC (I don't have the reference anymore so don't ask), Microsoft
advocated using .Value instead of relying on the default property of
the control based on the fact that they do not guarantee that the
current default property in a given version will be the same as the
default property in a future version. *I think they even gave an
example where the default property changed from .Value to something
else from one version to another.
Microsoft seems to have no KB articles extant advocating including the
default property of a control; actually they seem to endorse quite the
opposite. However,

http://groups.google.com/group/comp....ce6b6625508013

under 'Access Tip:' I include an example from the book "DAO Object
Model: The Definitive Reference" by Helen Feddema. I still think the
original idea was from Microsoft or from a Microsoft Press book, but
may have been from another author. I don't think I would have noticed
something like that by myself :-).

James A. Fortune
CD********@FortuneJames.com
Sep 2 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dom Nicholas | last post by:
Hi, My question is this : how do I detect from another window which didn't create a new window whether it exists ? For example, is there a window-id's container of some sort that hangs around...
31
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page...
5
by: Piotr | last post by:
Hi, I have a big main window, prepared in html, and a small one, opened by window.open in <script> in main window script. I would like to click in small one and open sth in main one. How to do...
0
by: Tom | last post by:
Here is a very strange problem that I am stumped by. I have a rather large application written in VB.NET (of course) using Framework 1.1. As you know, with an MDI application you can have multiple...
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
3
by: johkar | last post by:
My child window has this script. "temp" is simply the value of the select list which I am passing onchange. I get a permission denied error in IE when executing selectOption. function...
0
by: SAL | last post by:
Hello, I'm having trouble bringing a window to the front of all windows in an application I'm building. Actually, it's two applications that communicate via .NET Remoting. I'm trying to get the...
4
by: Al | last post by:
Good Morning All: We have an issue when we are using "target = 'new'" in an anchor. The first time when it opens the new window the window comes to the top of the stack but on subsequent...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.