By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,812 Members | 1,288 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,812 IT Pros & Developers. It's quick & easy.

save a report to excel or pdf based on the filter

P: 3
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
4 Weeks Ago #1
Share this Question
Share on Google+
6 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,355
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!
4 Weeks Ago #2

P: 3
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
4 Weeks Ago #3

twinnyfo
Expert Mod 2.5K+
P: 3,355
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.
4 Weeks Ago #4

NeoPa
Expert Mod 15k+
P: 31,660
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.
4 Weeks Ago #5

P: 3
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
4 Weeks Ago #6

NeoPa
Expert Mod 15k+
P: 31,660
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.
3 Weeks Ago #7

Post your reply

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