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

save a report to excel or pdf based on the filter

Hi
How do I design buttons to filter table data in a sub - form and buttons to export the filter
results as a report to Excel or PDF format so that the user can
Choose the name and path of the resulting report and that the report be extracted, either in
full or in part according to the user’s choice from a drop-down list
Jan 16 '20 #1
6 1821
twinnyfo
3,653 Expert Mod 2GB
adnangharbi,

Welcome to Bytes!

You will have to create a Form that the User can enter their specific requested directory/filename, as well as options for your other criteria.

What you are asking for is quite "straightforward" but very complex and somewhat complicated.

With as little information as you have provided, you will probably not get much response.

What have you tried so far? this is always the place for us to start. Perhaps a thread that describes a specific action you have tried unsuccessfully, and we can help you troubleshoot the issue.

Hope this hepps!
Jan 21 '20 #2
Thank you twinnyfo
I am really new to Bytes
I will try to clarify my question more:
I have a form named `frmUnits` contains three combo boxes to filter data in a sub form named `frmUnitSub` these combo boxes are:

1. `cmbUnitNum` which contains Units Number
2. `cmbUnitType` which contains Units Type
3. `cmbUnitGroup` which contains Units Group
the action to filter sub form is based on ((AfterUpdate))


What I want is use three buttons (`btnPrint`, `btnSavePDF`, `btnSaveExcel`) to print or save the report `rptUnits` as PDF and Excel format according to the following criteria:

1. The resulting report is based on filtering from the drop-down menu, on condition that when the user choose from any of the drop-down menu, the value of the other two menus is zero.
2. The user can choose path and name of resulting report.

Thanks
Jan 21 '20 #3
twinnyfo
3,653 Expert Mod 2GB
Honestly, I see three distinct threads:
  1. You need a method to filter a Report that is being printed, saved as PDF or exported to Excel (which MS Access does not make it terribly easy to do this. There are multiple threads on this forum to do that--search on Bytes for "MS Access VBA Filter Report From Form", and that should give you good starting places).
  2. You need to Clear the values of your combo boxes when any combo box has a user-selected value. Consider this a freebie: In the AfterUpdate event of each Combo Box, simply set the value of the other combo boxes to 0. Looks like you are already effecting filters on this event, so adding two lines of code should be simple.
  3. You need a method to choose a path and filename. There are multiple aspects to this, but the main one is using the Windows FileDialog features. Again, search this site for "MS Access VBA FileDialog" to get a starting point.

In summary, though, this site is typically not one in which we will do much of the heavy lifting for you. We love to assist, but most of us don't have the time to build something for you, when we have little information about your project. We expect you to work through the concepts, try out ideas presented and then we are more than glad to troubleshoot problem areas.

We are standing by to provide more hepp, as required.
Jan 21 '20 #4
NeoPa
32,556 Expert Mod 16PB
Hi Adnan. Welcome to Bytes.com.

What Twinny is saying is that we handle technical questions (Only one per thread.) here rather than generic project requests.

You start with a project idea or requirement. You get to work on it and, when you get stuck, you ask a specific question on the point you got stuck on, preferably including what you've tried that didn't work including error messages and code where appropriate.

It seems you're not quite ready yet at the point where you should be asking your question(s). Feel free to post again, in a new thread, when you get to that point.
Jan 21 '20 #5
Thanks NeoPa and twinnyfo for the precious advice, the truth is that I am not good at dealing with Bytes.com because I am new here and I understood from your answers that the question must be specific to a brief topic in order to get a typical answer and I deeply apologize for this misunderstanding
In any case my problem is only to save or print data from the sub-form according to the filter and I designed a virtual database to clarify the question as simple as possible but I do not know whether the database can be uploaded to the site or paste the codes into the comment?
Please tell me how you can get the database
Thank you both of you and I fully appreciate what you mentioned above
Jan 21 '20 #6
NeoPa
32,556 Expert Mod 16PB
Hi Adnan.

You can paste code in, and you can also upload databases when that is requested of you. However, that would not be appreciated (Posting databases). See How to ask "good" questions -- READ BEFORE SUBMITTING A QUESTION!

Even now you seem to be struggling to follow guidance so I hope the linked explanation will help you to get it right going forward. If you can't follow the instructions then you will be unlikely to get help and likely only to upset the moderators if they have to waste time deleting them.

Typically, code is sometimes required in your question. That's fine as part of a question. You should only ever post your database if requested to because that isn't a question. Most experts see posting a database without previously being asked to as disrespectful. This does you no good as the experts will simply avoid dealing with your threads.

I can see you're new, and that's fine. We do have threads in each forum that indicate they should be read before posting any questions. Not everyone does, but they should. Twinny & I have also given abbreviated directions on how to post properly. Your latest question explains you're new, but then goes on to ask how to do things that are inconsistent with what we've already spent time explaining. You have to pay attention when people tell you things. Patience rarely lasts for ever.
Jan 21 '20 #7

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

Similar topics

2
by: mic_Design | last post by:
hello my vb application fills an excel worksheet with data. i use activex commands. if i try to save the excel sheet, and the document allready exits, i get a message box. how can i do the save...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
2
by: Li Pang | last post by:
Hi, Anybody knows how to close an Excel object and save the excel sheet but without the interruption (confirmation) Thanks in advance
1
by: mpmason14 | last post by:
how can i create the title for my report based on the filtered criteria in a form? the form opens the report and i want the report to have the title of what was filtered. the user can filter among...
1
by: iqedgeman | last post by:
I am using an excel spreadsheet to insert content for a report. I can access an excel spreadsheet ("sheet1") without any problems and change the rows and columns. And I can save my spreadsheet as an...
3
by: Remaniak | last post by:
Hi All, I use the code below in my form to filter data. But I also need to export the data to excel. So I'd like to create a temporary query based on the strWhere and export that query to excel....
7
by: shantanu | last post by:
Hi all i am trying to save a excel file as a tab delimited text file. can i do it some how? i using the code _sheet1.SaveAs(@"C:\PRP \PRPTemp.txt",Excel.XlFileFormat.xlTextWindows...
3
by: MLH | last post by:
Private Sub Command0_Click() Dim MyReport As Report MyReport.Name = "rptStateOfAffairs" MyReport.Filter = "ClusterName = 'Auto Company, Inc'" Me.FilterOn = True DoCmd.OpenReport MyReport.Name...
0
by: Aravind555 | last post by:
Hi, I like to update access data base from excel , based on primary key. also i like to know how to get customized report(query) in Excel where i may need to do only refresh in excel Thanks...
8
by: Eddie Nugroho | last post by:
I have a main form, FrmMain. Put a button to open "FrmPrice". Works OK. In FrmPrice I put another button that open a report, ReportOffer, based on FrmPrice. Works OK too. I tried to put a button...
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: 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: 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?
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:
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...

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.