I would like to use VBA to format MS access modern charts in forms, for example adding a trendline, turning on data labels etc. I have searched but cannot see any methods or data structures to do this. Can anyone point me in the correct direction?
This may give you what you want.
https://www.youtube.com/watch?v=0QADS5XxVIs&ab_channel=Microsoft365
Keep in mind...Access is a NOT a great tool for creating charts. As an alternative, you may want to import your data into MS Excel, from Access, and create your Trend Line in Excel. There are so many ways to move data between Access and Excel, back and forth, so if you get stuck with one app, just switch to the other app!
Related
I am trying to insert a 3D flow chart into a word document using VBA, I have been asked to do this and I have no idea how to do this even after some research.
Sorry I have no code examples because I am at a loss on how to do this, and could probably misleading if I posted any :-)
Any help or direction would be greatly appreciated.
Mark
It is possible to use vba across different programs but adds a bit more complexity - added to which vba uses different objects and methods depending which program you're in.
Your best bet is to record as much of the macro as you can inside MS word, then edit the vba and transfer it to MS Access (I assume you'll be working with variables from the MS Access file or VBProject anyway).
This post would be an excellent starting point - yes, it's made for use in Excel, but the Word Object Model is used the same way.
I created an excel workbook to track inventory for a project that my wife is working on. It does a ton of useful things for her but I have so many other good ideas for it to do more. It has gained some attention from some of her friends and I would really like to share it with them but keep everything locked so that they cannot accidentally mess anything up. With that said, I want to keep developing it as I come up with improvements.
My question is, does anyone know a way that I can basically release versions of an excel just like a a code upgrade? I want to be able to pass this thing along and then when I make some improvements I can release them but nobody loses any data or has to copy and paste data. Would this be something I could accomplish with VBA? anyone have any thoughts?
I had a similar problem a few years ago.
I ended up using two VBA macros to automate data migration from the old version of the workbook to the new version. Here are the high level steps:
Step 1:
Lock all of the cells except the inputs and options to the model so that you know where each piece of data is located (named ranges are helpful here).
Step 2:
Write a VBA macro to scrape the values out of the unlocked cells and save them into a CSV with a particular format.
Step 3:
Write another macro to load in the CSV you created in step 2 and fill those values in to the input cells.
Step 4:
Add in a few buttons to your workbook so that your users can easily access both macros.
When your users want to upgrade from one version to the next they will export their data from the old workbook into the CSV and import it to the new workbook. There are more elegant solutions but in my opinion they aren't worth the extra effort to implement and maintain.
Depending on what you're doing Google Sheets could be a good alternative too!
Apps can be easily updated because most of them have separate files for data, settings, user interface and functionality. In Excel usually all of that is combined in only one file, so it is very hard to separate them and update only the functionality without affecting the data. If you can figure out how to store the data in separate files, then updating would be easier.
I Found this spreadsheets online which I would like to flatten out and import into a MS SQL Server Database. The issue is that the spreadsheets have the same layout but is in a report format.
Any suggestions on how to flatten out this spreadsheet as there are to many sheets in one of this spreadsheets to do this manually. There are also a couple of different years of spreadsheets.
Click here to open one of these spreadsheets
I want to be able to import this into my database and play with the numbers
I would recommend creating a staging area and importing each of the tabs into it's own specific table. This would give you the flexibility to work with the data initially. Then you would be able to easily flatten the data and transform it to your specifications. Also, this would be a good approach if you wanted to bring in only a couple of tabs in the beginning and flatten them. You could then extend the dataset by bringing in the tabs as you wanted to process them.
Why excel? Well excel is what is used to import the player salaries.
Now I need the spreadsheet to do the following.
Create teams within salary cap.
Include/exclude specific player function
Build multiple lineups from a selected list of players within the cap
Can I do all of this with excel? or do I need to know excel vba as well?
Also which parts of excel or if necessary excel vba must I need to know to code such a thing? Also if someone could give me a short summary of the steps needed to hypothetically make such a thing it would be great. Thanks.
I'm posting this as a reply because it is too long for a comment window.
Just because Excel has a grid doesn't mean that it is fit for data storage and data handling, on the contrary.
What you typically want to do is create a transparent structure that guarantees the integrity of your data and that allows dynamic portability when needed one day.
Excel is meant to be a spreadsheet, people forget this all the time or they just avoid the topic: although Excel has a grid, doesn't mean that it is a good fit for reliable data storage. It is not even the least complex way of storing data, depending on the amount of VBA that you need to manage all these data and the gates that you unnecessarily open towards potential bugs.
This is why an RDBMS is what will fit your needs, in this case Access would be a good option as it preserves your data integrity if you get the table structure right and it executes a lot of tasks for you that you should otherwise need to program yourself to protect the integrity of your data.
Although you can perform SQL on spreadsheets too, note that Excel does NOT cover related tables (what you typically seem to need for building your teams and salary limits), so what many Excel programmers will typically do is to create their own code to make this cross-table data storage thing work.
Don't do this if the alternative is available and much more reliable and future-proof.
At first sight, it seems that you won't even need any VBA; I'm not sure of all the things you want to do, but my first impression is that you can manage everything with SQL syntax and stored queries in MS Access. You can import Excel sheets into Access if you get their format right so that should not be a problem.
Once your data is stored there, rest assured that you have made your life a lot easier.
I'm looking someone who can help me with this issue, that seems very easy to achieve but there is no much information around the internet.
I'm working with MS Access and Visual Basic, and I would like to create a simple bar graph, giving params that I've already gathered from many querys.
In this case: A chart about Litres per Week. I have a query to gather the amount of litres of 4 different weeks. I also provide the information for the X Axis (Last week, Last two weeks, and so on.. ). It would look like this:
So I'm wondering if this can be done, as well a pie charts and line charts.
I'm aware that this can be easilly done with Excel, but I don't want open another program to read information.
Thank you very much.
How to make Charts in MS Access would be my first key word search :)
Then I will check on MSDN for proper tools/properties availability/updates on software and so on.
Here is a simple basic tutorial to follow
This is the entire google search that would provide you anything you want to check on the topic.
Please note the version of MS Access you are using against the tutorials described. In certain versions there are certain changes have been done to the software itself. You are much lucky if it's not 2007...
EDIT Based on the comments with OP:
Since OP has exhaustive/heavy queries, it's recommended to create a temp table based on the final query.
Then temp table can act as a view and become the data source for the Chart
dynamic binding of chart from database in VS2010 in C#
Bind query as a datasource to MS Access chart. There is a method called databindtable which is a chart property. You may use it:
e.g. chart1.DataBindTable(yoursource,columname)
This article provies a good sample code.