473,320 Members | 1,933 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,320 software developers and data experts.

a2k - my solution to opening reports modally - comments?

I've been mulling over how to prevent users from clicking back onto my form
after they have run a report. I want them to close the report first.

The simple solution which I have tested successfully is simply to hide the
calling form and make is visible again in the Close event of the report.
Seems fine to me but can anyone see any flaws in this?
Nov 12 '05 #1
3 1834
Hiding the form will probably do all you need.

In Access 2002 and 2003, you can open a report modally if you need to:
DoCmd.OpenReport "MyReport", WindowMode:=acDialog

An underlying issue is why the form needs to be open and not changed?
If the report is dependent on the form in some way, you may be able to avoid
that by reading the values from the form in the Report Header secton's
Format event, and assigning the values to unbound controls on the report,
instead of binding those controls to an expression that looks at the form.

Alternatively, if the problem is that the user flicks back to the form and
hits the your OpenReport command button again which does not filter the
report correctly, you may want to code to close the report and reopen it:
strDoc = "MyReport"
If SysCmd(acSysCmdGetObjectState, acReport, strDoc) = 1 Then
DoCmd.Close acReport, strDoc
End If
DoCmd.OpenReport strDoc

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Deano" <de*********@hotmail.com> wrote in message
news:3b*******************@wards.force9.net...
I've been mulling over how to prevent users from clicking back onto my form after they have run a report. I want them to close the report first.

The simple solution which I have tested successfully is simply to hide the
calling form and make is visible again in the Close event of the report.
Seems fine to me but can anyone see any flaws in this?

Nov 12 '05 #2
Allen Browne wrote:
Hiding the form will probably do all you need.

In Access 2002 and 2003, you can open a report modally if you need to:
DoCmd.OpenReport "MyReport", WindowMode:=acDialog

An underlying issue is why the form needs to be open and not changed?
Good question. Well I'm in a testing phase at the moment and I did notice
yonks ago that I experienced a lockup/crash if I left a report open and then
merrily switched forms.
Basically I have a form that allows various reports to be run and and when
the user exits this form, I think it's reasonable that they have closed the
reports down.
It also looks less confusing, and given the ability of my users I think any
opportunity to stop them confusing themselves should be embraced :)
If the report is dependent on the form in some way, you may be able
to avoid that by reading the values from the form in the Report
Header secton's Format event, and assigning the values to unbound
controls on the report, instead of binding those controls to an
expression that looks at the form.
Thanks for that tip.

Alternatively, if the problem is that the user flicks back to the
form and hits the your OpenReport command button again which does not
filter the report correctly, you may want to code to close the report
and reopen it: strDoc = "MyReport"
If SysCmd(acSysCmdGetObjectState, acReport, strDoc) = 1 Then
DoCmd.Close acReport, strDoc
End If
DoCmd.OpenReport strDoc
Thanks again.

"Deano" <de*********@hotmail.com> wrote in message
news:3b*******************@wards.force9.net...
I've been mulling over how to prevent users from clicking back onto
my

form
after they have run a report. I want them to close the report first.

The simple solution which I have tested successfully is simply to
hide the calling form and make is visible again in the Close event
of the report. Seems fine to me but can anyone see any flaws in this?


Nov 12 '05 #3
de*********@hotmail.com (Deano) wrote in
<QJ*******************@wards.force9.net>:
Well I'm in a testing phase at the moment and I did notice
yonks ago that I experienced a lockup/crash if I left a report
open and then merrily switched forms.
Basically I have a form that allows various reports to be run and
and when the user exits this form, I think it's reasonable that
they have closed the reports down.


In the UnLoad event of your reports form, do this:

Dim rpt As Report

For each rpt in CurrentDB.Reports
DoCmd.Close acReport, rpt.Name
Next rpt

Set rpt = Nothing

This will cycle through all open reports and close them.

You could also have this happen in the OnActivate event of the form
if you want to close reports when the user gets back to your
reports form.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #4

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

Similar topics

5
by: Tim Marsden | last post by:
Hi, I get the following dialog appear each time I open my VB.NET solution in VS.NET 2003. "The source control bindings for project xxxxx differ from those stored in the solution file. Both...
0
by: Merek | last post by:
Hi all, We need to allow the user to store, view and edit blocks of rich text via an ASP.NET application. After adopting one of the many rich text editors out there that outputs HTML we are...
10
by: Tim Mulholland | last post by:
My company is about to begin working on an ASP.NET application. There are going to be two primary developers working on this project. It will be a fairly deep project (lots of lines of code) but...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
12
by: insomniux | last post by:
Hi, In my database (access 2000) everything is done within the main form ("OpenForm"). It has a timer which triggers the code below. It first closes all reports and forms. Then it reopens the main...
1
by: kkrizl | last post by:
I've tried to research this problem, and I haven't been able to find any references to it. Probably because I shouldn't be doing it, but it was working, and now it's not. I'm trying to develop a...
8
by: grant | last post by:
Hi I've copied Stephens code into my db, and can get it to work, but only on "plain Jane" reports with no images. Most of my reports has an unbound image obluect in them that I set to an...
14
by: W Marsh | last post by:
Hi. In my application I do something very simple - I open a file, lock it exclusively, write some data to it and close it. If I re-open it in the same process (I mean before the script has...
0
by: LiveTecs | last post by:
http://www.livetecs.com TimeLive Web Collaboration Suite is an integrated suite that allows you to manage project life cycle including tasks, issues, bugs, timesheet, expense, attendance. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.