How do I get the report to not spend time pulling up the data when I'm
going to bail out of the report anyway?
Below is the code in my report. I first show the user a form where
they can select some filtering parameters which I put in Getz's
TaggedValues class. But they can hit a Cancel button if they decide
they don't want any report. When I test the Cancel button I'd like the
report to close immediately but it seems to spend some time pulling up
data first.
(I've tried to put docmd.Close in the Report_Open but that closes the
whole database so I've been putting it in the Report_Activate .)
The Record Source is a query and the report has no fields that are
calculated, all fields are straight from the query.
Any advice?
THANKS!
----- Here is the code...
Option Compare Database
Option Explicit
Public CloseNow As String ' I know boolean would be better
Private Sub Report_Open(Can cel As Integer)
Dim strMyFilter As String
Dim tv As TaggedValues
CloseNow = "No" ' Public string
' This form sets TaggedValues in both OK and Close
' buttons, then sets its Visibile = false
DoCmd.OpenForm "frmSelectOpChe ckVars", , , , , acDialog
Set tv = New TaggedValues
tv.Text = Forms!frmSelect OpCheckVars!txt MyTags.Tag
' Close the selection form
DoCmd.Close acForm, "frmSelectOpChe ckVars"
If tv.Item("Cancel ed") = "Yes" Then
MsgBox "Click OK to close. This may take a few seconds... ", ,
"REPORT CLOSING"
CloseNow = "Yes"
Else
' set strMyFilter here...
Me.Filter = strMyFilter
Me.FilterOn = True
End If ' end of If canceled = yes
Set tv = Nothing
End Sub
Private Sub Report_Activate ()
If CloseNow = "Yes" Then
DoCmd.Close
End If
End Sub 2 1639
Start with the following code somewhere:
DoCmd.openRepor t ......
On Error Resume Next
The On Error code is necessary because Access will raise an error when you
cancel the report.
Put your code to open your form where users can select some filtering
parameters in the Report's Open event. The code would look like:
DoCmd.OpenForm "MyParameterFor m",,,,,acDia log
If IsLoaded("MyPar ameterForm") = False Then
Cancel = True
End If
(You can find the code for the IsLoaded function in NorthWind's standard
modules.)
You will need a button on the form to Continue after the users select the
parameters. The Continue button code would be:
Me.Visible = False
Put the following code in the Cancel button's Click event:
DoCmd.Close acForm, "MyParameterFor m"
Put the following code in the Report's Close event:
DoCmd.Close acForm, "MyParameterFor m"
The form doesn't load unless you select parameters and Click the Continue
button so it won't prematurely pull up any data.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications re******@pcdata sheet.com www.pcdatasheet.com
"Denise" <dh*****@gmail. com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . How do I get the report to not spend time pulling up the data when I'm going to bail out of the report anyway?
Below is the code in my report. I first show the user a form where they can select some filtering parameters which I put in Getz's TaggedValues class. But they can hit a Cancel button if they decide they don't want any report. When I test the Cancel button I'd like the report to close immediately but it seems to spend some time pulling up data first.
(I've tried to put docmd.Close in the Report_Open but that closes the whole database so I've been putting it in the Report_Activate .)
The Record Source is a query and the report has no fields that are calculated, all fields are straight from the query.
Any advice? THANKS!
----- Here is the code...
Option Compare Database Option Explicit Public CloseNow As String ' I know boolean would be better
Private Sub Report_Open(Can cel As Integer) Dim strMyFilter As String Dim tv As TaggedValues
CloseNow = "No" ' Public string
' This form sets TaggedValues in both OK and Close ' buttons, then sets its Visibile = false DoCmd.OpenForm "frmSelectOpChe ckVars", , , , , acDialog
Set tv = New TaggedValues tv.Text = Forms!frmSelect OpCheckVars!txt MyTags.Tag ' Close the selection form DoCmd.Close acForm, "frmSelectOpChe ckVars"
If tv.Item("Cancel ed") = "Yes" Then MsgBox "Click OK to close. This may take a few seconds... ", , "REPORT CLOSING" CloseNow = "Yes" Else ' set strMyFilter here... Me.Filter = strMyFilter Me.FilterOn = True End If ' end of If canceled = yes
Set tv = Nothing
End Sub
Private Sub Report_Activate () If CloseNow = "Yes" Then DoCmd.Close End If End Sub
Yes, that worked perfectly!
Thanks for the quick response.
Denise This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Aadam |
last post by:
Does Microsoft have a best practices for tracking errors? (like in a
database, what info, etc)
|
by: byrocat |
last post by:
I'm chasing after a documetn that was available on one of the Microsoft
websites that was titled somethign like "MS SQL Server Best Practices"
and detailed a nyumber of best practices about securing the server.
Included in this was revoking public access to the system table
objects.
Can someone post the URL where I can pick this up, or drop me a note on
contacting them for a copy of the document?
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their code
was littered with document.all and eval, for example, and I wanted to create
a practical list of best practices that they could easily put to use.
The above URL is version 1.0 (draft) that resulted. IMO, it is not a
replacement for the FAQ,...
|
by: john doe |
last post by:
A quick question, about so-called 'best practices', I'm interested in
which of A/B of the two examples people would choose, and why.
public enum MyEnum
{
Option1 = 0,
Option2 = 1,
Option3 = 2,
Option4 = 3
|
by: Amelyan |
last post by:
Could anyone recommend a book (or a web site) that defines best practices in
ASP.NET application development?
E.g.
1) Precede your control id's with type of control btnSubmit, txtName, etc.
2) Group relevant .aspx files into subfolders within your project
etc.
| |
by: Luis Esteban Valencia |
last post by:
Hello. Can somebody recomend me books of design patterns in c# and best
practices too.
|
by: jojobar |
last post by:
Hello,
I am trying to use vs.net 2005 to migrate a project originally in vs.net
2003. I started with creation of a "web site", and then created folders for
each component of the site.
I read somewhere that each folder under the "web site" is compiled in
separate assembly. I however, did not find that the "web site" creation in
vs.net 2005 created any AssemblyInfo.cs file.
|
by: Louis Aslett |
last post by:
I hope this is the correct newsgroup for this query (if not please
give me a pointer to where is best):
I understand the theory of normalisation etc and am trying to follow
best practices in the design of the database for a new project, but I
am unsure as to the best practice when one wants to store data
relating to combinations of arbitrary numbers of sets of data. For
example, take the following two groups of sets, each containing...
|
by: Ren |
last post by:
Hi All,
I'm still rather new at vb.net and would like to know the proper way to access
private varibables in a class. Do I access the variable directly or do I use
the public property?
public class MyClass
private _variableName as integer
public property VariableName as integer
|
by: Pablo |
last post by:
Hello all,
Hope today finds you well.
I'm looking to take my knowledge of best practices within the
development lifecycle to the next level.
Basically I want to follow industry recognised, Microsoft approved
practices for every aspect of the lifecycle - so planning and
architecture, team development, testing procedures, change control and
bug-tracking, version control - etc etc. What software to use, which
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |