Generate Reports from Ms Access 2007 Using Queries automatically via VBA - sql

I have a few queries which need to be exported into a report and I want this to be done automatically each time the database is opened. I'm guessing this would be possible using VBA to which i dont have much knowledge off.
Can anyone help with this please?
Thank You

The easiest way would be to build a report based on the queries and add an Autoexec macro to the database to print the report.
EDIT
Choose Create Macro, select Open Report as the Action, select the report name from the dropdown list, save the macro as AutoExec.

Maybe I'm missing something in your question but it sounds like you just need to base the report's record source on the SQL and don't need VBA. Copy and paste the SQL directly into the report record source. Every time you open the report it will automatically pull the most recent data.

Related

TFS Query for Displaying How Long Tasks Take To Go From Created to Closed

TFS 2015 Update 3
How can I create a TFS query that will display a list of tasks and how long it took for the task to go from created to closed? Maybe I will need to create an Excel report for this? Or to export the report I have to Excel and then add formulas there? I would prefer to not have to add formulas in Excel, but it's okay if I do.
Here is what I have so far:
There is no this kind of work item query will directly return the actual time taken for a Task from active to closed.
Your workaround extracting the data to Excel to analyse works perfect. I thins this is the simplest way to achieve what you want.
Moreover, you could also query the work item history with the TFS API and check the times tamps on when the state transitions occurred.

MS Access reports issue?

I have an already existing report that runs off a particular query. This report runs perfectly. I was having an issue with one of the CLIENTs for the report, where I had to change a small piece of information. This required me to run some VBA code and insert all the info into a temp table. I'd like to run the same exact report, however, instead of using a query, to use the tempInfo table. Is there a way for me to do that? it's okay if I create another report, but the first report is somewhat complicated - so it would save a lot of time if I could just copy and paste at least the GROUP, SORT TOTAL so my data is displayed correctly. ANy suggestions?
Copy the report that you are wanting to use and paste it in the navigation menu to create a copy of it.
To use the "Temp Table" in your report, just go into design view of the newly copied report and change the Record Source to your "Temp Table."
You may also need to change the control source of any textboxes, labels, etc..

Can Powerpivot be used to present data without pivoting it?

This isn't a coding question, so much as it is a functionality question.
I'm a bit new to Powerpivot and I'm attempting to use Powerpivot as a way to deliver reports to my team rather than SSRS because in our company, the only SSRS ReportServer I can use is officially "owned" by a team that is hostile to my team.
I have written numerous SQL ad-hoc queries that we are using for reports in SSRS, but been I've trying to migrate them to Powerpivot. For some of the reports, I've been able to paste the SQL query into the powerpivot window and make a pivottable out of these. However, I'd like to be able have some workbooks just contain the results of the query (they don't deal with numbers, as some of them are a data dump or a large collection of text strings), so that they look like the powerpivot window's dataset, but that they can be filtered, sorted, etc. Is this possible, or can I only use pivottables? I can't seem to find a way that I can just get Excel to directly display what is in the Powerpivot window without pivoting it - I know it is called Power*pivot* but because the PP window just shows the query results itself, I'm hoping there is a way to use it as an alternative to SSRS.
Also is there anyway to check if our Sharepoint server is capable of running Powerpivot so that I can deploy reports there for users to use without having Powerpivot installed on their computers other than by saving it to Sharepoint and seeing if a user can run it? If not, how difficult would it be to have an IT team update the SP server so that it can handle PP?
Any help is appreciated, as I'm in a position where I cannot contact IT or project management, and I can't raise any red flags with IT/BI/PM. Thank you very much for your time.
It sounds like you just want to get the results of your SQL query directly into an Excel spreadsheet, where you can use the Excel filter and sort capability. It doesn't appear that you want to use any of the functionality that PowerPivot provides, so you can achieve what you described by using an existing Excel component, Microsoft Query. It's a bit of a clunky old interface but it works. Here's some instructions to use:
In an Excel spreadsheet, click on the Data tab, select the "From Other Sources" button on the Get External Data area of the ribbon.
Select "From Microsoft Query"
On the "Choose Data Source" click OK to create a new data source
On the "Create new data source" window select the appropriate driver and database details for your data source
If using a SQL Server data source, don't select anything for the optional step 4 (select a default table).
Click OK to return to the Choose Data Source window, then OK again to select the new data source.
You're now prompted to choose columns for your query, but if you already have some SQL then click Cancel - this will display a prompt to continue editing in Microsoft Query - click Yes.
The Add Tables window pops up, click Close
You're now in the Microsoft Query interface. If you click on the SQL button, you can paste in your SQL. Click the Return Data button to run the query, the results will be displayed in an Excel worksheet.
Once this is set up, you just need to click "Refresh Data" on the Data tab to re-run the query and update the spreadsheet.

Exporting Excel files from SAP with pivot tables

I currently have a report which will be emailed to business users weekly. The data output can only be csv/xml and I do not have the ability to automatically add the requested pivot tables; therefore, I am attempting to pull the data with a Workbook_Open sub routine in an Excel file I will have premade. My issue here is I cannot use Macros on SharePoint nor can the Data be publicly accessed in a Macro...so I feel like I am up a creek.
Any suggestions from a VBA, Excel, or BEX/BOBJ standpoint?
Well if your report is forced to be csv/xml.... and you can't access the data directly through a macro... the solution is not terribly straight forward.
Here is how I would solve
1) SAP Job drops off file
2) Some type of automation kicks off a macro
3) Macro formats and emails report
probably possible to have sap email a spreadsheet formatted to taste directly via abap code.... that is not something i have much experience with.

Dump MS Access Macro object info from VBA code

I have a project in which I need to compare different versions of an Access 2003 database against each other. We're not interested in the data in the tables. We're only interested in the objects that describe the database. I.e. Form objects, Report objects, QueryDefs, TableDefs etc.. The databases are fairly large so the approach is to dump all the descriptions for objects of interest into a text file by running a VBA app in each of the databases and then comparing the results in a diff viewer.
I've been looking around for several days to find out how to dynamically dump access 2003 macro content from within VBA. Please don't confuse this with dumping VBA code from VBA.
I know about Application.CurrentDB.AllMacros to get a list of macros in the active access database. But I can't get at the macro object from Macro(MacroName).SomeProperty because the macro isn't open. So I've been trying to look for a way to open the macro and haven't found a way to accomplish this through VBA.
Any help on the topic would be appreciated.
Thanks!
You can export macros with the undocument Application.SaveAsText:
Application.SaveAsText acMacro ,"AutoKeys", "AutoKeys.txt"
...saves the AutoKeys macro to whatever the current directory is.
You could manually ask Access to convert the macros to VBA. There is an option for that, I think when you right click the macro. After that you can compare the generated VBA.
See the following page for a list of utilities to compare Access databases
http://www.granite.ab.ca/access/thirdparty.htm