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

How to Reset a report back to default state before closing report

Hi,
I have a report which fetches a row from a table during report_load event and populates the relevant labels and sets the subforms recordsource.
I have an exit button and would like to reset the controls and recordsource back to its previous(default) state as it was before report_load.

Why I want to do do this:
When i open a report (from a form button click) for the first time, it invokes the report_load event, but when i return back to main form from the report (through button click) and select another record, the report opens up with the previous record

I have tried the below:
in report exit button click event:
I am unable to unload the report(Unload Me),
Docmd.close is not unloading the report

online solutions i found:
invoke the OnOpen command of report, (please assist)
set recordsource of subform to nothing (not helpful)
Please help...
Jun 10 '16 #1
1 1024
zmbd
5,501 Expert Mod 4TB
+ As for your code, without yours, it's fairly difficult to help you with this particular issue. Please make sure that you select your VBA Script and format it using the [CODE/] tool.

+ Normally, you wouldn't have the report drive things on the form. However, I would look at the on_close event of the report to interact with your form.

+ Normally one would be passing the information to the report from the form when the report is opened not pulling information from the form to the report.

There are various methods normally used to do this; however, AFIK, parameterized queries based on forms tend to be one of the more common methods followed by "Open Augments" and filters.

I do have a database where the report does drive the user interface on initial opening; however, this only because:
1) The underlying report record source is a query based on a form that collects user input. This forces the report loading to halt because the query needs information which results in the form opening (no vba :) )
2) Once the user clicks on [Submit] the form is hidden (and if the report is closed, reopens the report which because the form is already open the query runs and the reports opens); thus, allowing the report to finish loading.
3) The report's on_close event unhides the form for more user interaction if needed.

+ IMHO, your report should not be setting record sources in the calling form - especially subform(s). The subform(s) should normally be handled by the parent form, not a report.

+ One of these threads may provide you with a few ideas on how to approach your report/interaction from a different angle:Search results on Bytes.com Key words: [open report with current record] (read more)

when we have a bit more information about your on_load event code we can go from there if you insist on going this route.
Jun 11 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Esmee | last post by:
Hi there, I have created an Access 2002 db which contains several reports. Some reports need to be printed on a Laserjet and others on a Labelprinter. One of my clients wants to be able to print...
0
by: psinyc | last post by:
this may be a simple thing ... I am trying to reset all the page controls to their original setting, in the first line of this method call (event). I want to dynamically change the days of month...
7
by: Dan Palm | last post by:
I have a some online web report which are generated into html pages from a SAP application. When the report is printed it prints over multiple pages. Currently, as there is no page break, the...
12
by: Orchid | last post by:
Hello all, I have different version of reports which used for different months. For example, I am using report version 1 up to September, but we have some design changes on the report for October,...
3
MattFitzgerald
by: MattFitzgerald | last post by:
I have a main menu ("Frm_Startup") which contains a drop down box for selecting a field "LE ID" from my customer table where the "LE ID" is the primary key and there is another field with the...
5
by: jamesnkk | last post by:
Hi Could someone assist - When user preview the Report, he or she can right-click to change the report. how can I disable the Report Design option to prevent them from changing ? After closing...
11
tuxalot
by: tuxalot | last post by:
The easy way is to put cancel = True in the On No Data event of the report. But why replicate code across all reports that way? My app selects reports from a listbox, so I would prefer to check the...
1
by: Waganjika | last post by:
How can I code preview a report designed using c# crystal report? The Application builds successfully, and all other functions works alright but when I select from menu to preview a report,...
1
by: samvb | last post by:
What would be the easiest way to reset a database to its initial state? TRUNCATE all tables is one option but then the problem with FK constraints is there. DELETE takes a lot of process while DROP...
0
by: gaurang99 | last post by:
How can i change Default margin of Report Viewer from 1 to 0.75 in vb.net with VB script.
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?
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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.