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

PDF report based on combo selected records.

Hi
Ok so I have a database that serves as product catalog. A report1 is generated based on user price filter (say to desplay all products cheaper than $100).
My question: in this report, each record should show like a combo selection box. At the end of the report there is a button to create pdf. This button should create a pdf file showing only the records which the user selected from the filtered list. (Say report1 shows 20 items, and the user selected 5 products from this list to print to pdf).
The status of combobox should not be stored in any table as it's local for that report only.
Any hints or guidlines?
Jan 29 '17 #1

✓ answered by Seth Schrock

The following code will open the report:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport ReportName:="YourReportNameHere", View:=acViewPreview
You just need to have the record source for the report to include
Expand|Select|Wrap|Line Numbers
  1. "selection_field = True"
in the WHERE clause.

If you have an unbound control on either a form or report in the detail section (so that it gets duplicated for each record), then changing the value of one, changes the values for all of them. The only way then to be able to select one record and not another is to have a field for the control to be bound to. However, reports don't allow you to edit records so you are back to using a form.

You could also create a table and use a combo box to select the records that you want, but this would be even more work than my previous suggestion.

While there are usually hundreds of different ways to do any given thing, there are also limitations on what can't be done. My second paragraph tells what you can't do. It is up to you to decide what you want to do instead.

5 964
Seth Schrock
2,965 Expert 2GB
You can't have a combobox for each record unless it is tied to a field in the report's record source and if this is the case, then values can't be changed in a report. What you should do instead is to display a form, allow the user to make their selections (again, this has to be tied to a field in a table) and then generate the report based on the selections.
Jan 30 '17 #2
Thanks for your input. I will look after it, although am not into creating a table field to tie the selection to but will so it if that's my only choice.
Any reliable code for the "on click" event to preview the report that shows only the selected records?
Jan 31 '17 #3
Seth Schrock
2,965 Expert 2GB
The following code will open the report:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport ReportName:="YourReportNameHere", View:=acViewPreview
You just need to have the record source for the report to include
Expand|Select|Wrap|Line Numbers
  1. "selection_field = True"
in the WHERE clause.

If you have an unbound control on either a form or report in the detail section (so that it gets duplicated for each record), then changing the value of one, changes the values for all of them. The only way then to be able to select one record and not another is to have a field for the control to be bound to. However, reports don't allow you to edit records so you are back to using a form.

You could also create a table and use a combo box to select the records that you want, but this would be even more work than my previous suggestion.

While there are usually hundreds of different ways to do any given thing, there are also limitations on what can't be done. My second paragraph tells what you can't do. It is up to you to decide what you want to do instead.
Jan 31 '17 #4
Thanks man. Appreciate your replies.
I will utilies your method and add combo selection box to base table and change statusbin the form. I guess i will have to add small code to return selection status to false after submition.
Jan 31 '17 #5
Seth Schrock
2,965 Expert 2GB
That would be a good idea. You can use an UPDATE query to change the values back.
Jan 31 '17 #6

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

Similar topics

3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
3
by: DD | last post by:
I have a mainform with a subform. > The main form has a dropdown box "chooseMonth", in the afterupdate event > i requery the subform so all records with the same date are viewed. > Now i only want...
1
by: Andrew | last post by:
How do I set up a report that runs after the user selects a month, (from a combo or list box on a form) so that the only data in the report is data from the month selected? I'm not too good with...
1
by: davidbennett | last post by:
Hello, I am new to MS Access. I have created a series of forms that users access to perform data entry. I now need to build in reporting functionality. I would like to create a form that has a...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
2
by: indrag91 | last post by:
hai, i am using access database. Iam selecting few records based on a condition. For e:g select * from stud where avg>90 and placing these records in a multiselect list box. for e:g if there 10...
1
by: Neobeowulf | last post by:
Team, I'm totally stumped on this one. I'm trying to create a button called "Run Report" that opens a report based off a selection made in a combo box then filtered by a column in the report...
3
LeighW
by: LeighW | last post by:
Hi there, Everytime a user edits data within the bound forms in the database the approval checkbox (which is a bound field) changes to "False". Is there a way of creating one sole report based...
3
by: ggftw | last post by:
Hi, I have 2 forms named frmProdSearchCat and frmProdSearchMaxPrice. They allow the user to search for several products based on the category and their budget respectively. I have a report named...
5
by: shawnrye1980 | last post by:
I have a table that has 15 managers and I have queries that I need for there employees I have 5 union all queries because there are too many where clauses, I have done this and based off the main...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.