473,405 Members | 2,373 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,405 software developers and data experts.

How do I print a report based off of a continous form's search results?

7
Hello,

I currently have a continous form that has a search field in the header. The search works without issue, but I want to be able to print a report based off the search results.

All the records have there own unique Record ID and they are all pulled from the same table.

I know how to print a report based off 1 record, but I can't for the life of me figure out the above problem.

Any help would be greatly appreciated.

I have MS Office - SP2 on Windows Professional.

Thanks
Nick
Feb 11 '08 #1
3 1884
Stewart Ross
2,545 Expert Mod 2GB
Depends on how your search works on the form. If your search box applies a filter to the records in your form via the control's after_update event, you can place a report button on the form which will open the report and apply the same filter to the report when it is opened, hence showing the same records. It takes very little programming of the on-click event of the report button.

Here is an example of a similar technique, used in this case to pick specific departments on which to report. This is from a selection form which uses two combo boxes, first_dept and last_dept, to select from a list of ordered departments. The default for the combos is "*" for show all, and as you will see from the code if this is the combo value the report is opened without a filter.

If the user selects specific departments the report is opened with a filter condition to show only the reports from the first to the last departments specified.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Click()
    Dim stDocName As String
  2. stDocName = "ACT001" ' change this to the name of your report
  3. '
  4. ' change the control name to the name of the search control in your
  5. ' form, and apply whatever filter is appropriate for your circumstances
  6. '
  7. If Me.First_Dept = "*" Then
    DoCmd.OpenReport stDocName, acPreview
    Else
    DoCmd.OpenReport stDocName, acPreview, , "[Sequence No] between " & Me.First_Dept.Column(4) & " AND " & Me.Last_Dept.Column(4)
    End IfEnd Sub
Cheers

Stewart
Feb 12 '08 #2
NMarks
7
The Search is actually done by an On-Click Command.

I have multiple text boxes allowing a user to search by 4 different items as well as by date range.
Feb 13 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
Ok, if it is an on-click response you are presumably building a filter condition or SQL 'Where' clause which filters the dataset based on the values in your text boxes. You should be able to use the same filter or SQL statement to filter your report...

If you can attach the VBA code for the on-click it would help to clarify next steps.

-Stewart
Feb 14 '08 #4

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

Similar topics

6
by: B Love | last post by:
I am wondering if I can have a dynamically generated report based upon the results of a query (in Access2000). Any ideas? Related to that (if that cannot be done) can the output of a query...
1
by: DD | last post by:
I have a mainform with a subform. The main form as a dropdown box "chooseDate", in the afterupdate event i requery the subform so all records with the same date are viewed. Now i only want to...
4
by: Jan | last post by:
I am having problems trying to print a report based on a form. This is a search form only, no data input. There is a query that the form looks at, but then there are numerous comboxes that you...
2
by: vulcaned | last post by:
Hi All, I'm stuck, so....... In Access97 I have a form which has a subform(setup as a continous form), after a user selects several things on the form the subform gets requeryed and displays the...
5
by: Nothing | last post by:
I have a search results form that is being displayed as a continous form. I want to double click the name and then using VBA select the different columns of information. For Example: Name ...
1
by: mfaisalwarraich | last post by:
Hi Everybody, I have an external database called Patients.mdb where i made a query called qryAdmissionDetails. now i want to run this query on a report of another database called...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
10
by: Snoopy33 | last post by:
I have a DB that I developed on access XP (2002) and deployed over a year ago. No one has had problems printing any of the reports within the DB until we started loading 2007 on new computers. ...
3
by: rajkumarpb | last post by:
Hi friends, I am new to this forum...But not for programming...I want a Print CSS File to be added in my page..OK.... Here is the page and i want you friends to help me create the CSS File...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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:
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
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
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
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
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,...
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...

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.