vba access get data from list box and store in an array - ms-access

Before I look any further on the internet to try and solve this, is actually possible to do this:
There are two list-boxes with data been displayed. The first list-box shows results from a SQL query. i.e. bus, cab, plane, lorry. The user can select certain data and then add it to listbox2. listbox2 could have the following data: bus, cab, plane in it. what I am trying to do is this:
None of the data has been selected, when an export button is clicked, it loops through listbox2, gets the data from the list-box (Bus, Cab, Plane) and stores it in an array, what I want to do next, is query it in a SQL statement to get the results back to be exported to excel. I can do the SQL part and exporting.
I thought it I would be able to do the code for this, but the amount of different loops and other methods I try it complains. I can get it to count how many rows there are in listbox2, but not pull the data from it.
Looking on the internet the majority of information I seem to find is when it requires data to be selected first - and very little that is based on vba in access, as VBA/VBA Excel is different from the VBA in access so I have found (Urgh)
I'm not expecting someone to give me a coded solution to this, I just want to know before I waste any more time, is this actually possible to achieve?

Related

Loading an Excel Validation list directly from a SQL Query

I want to know if it's possible to load an Excel Validation list directly from an external query. I'm expecting to do this in VBA somehow. I have the query which works fine and I can load the resultant list into a table in a worksheet via VBA without a problem, but I wanted to know if I can use this result set directly into a validation list without having to first load the query results into a workbook and then refer to this table as the source for the validation list.
I'm working with MySQL and Excel 2016 and the combination works well for everything so far, but I'm stuck on this. Any ideas please?
Yes, you can and it is easy if you use Excel tables.
You need to always save the records returned from your SQL query into an Excel table. You can create it each time or you can just create one, rename it and always keep it there in a visible or hidden worksheet. It depends on you.
Let's say that you have created an Excel Table that keeps the options for your drop down list and it is called Table1. The trick is when you are defining the validation in the cell (or cells), in the Source section you write this:
=INDIRECT("Table1")

How to handle very large data with Tableau

All,
I am using Tableau 9.0 to do data analysis. My data set is very large containing 100 billion records.
I want to use filter to filter out the data firstly. But, when I try to add filter on the specific column of the data in Tableau, it keep running... for ever. The reason is tableau wants to display all this field value to me with ascending order, then allow me to make selection. e.g to select only one or two value to filter...
But it keeps running due to 100 billion records. How to solve this problem? Could I switch off this function (display all specific field value..)? How to filter so large data sets?
Thank you in advance
Pause Auto-Updates via the toolbar pause button before dragging a field to the filter shelf (or doing anything that you don't want to trigger a query refresh). Then either hit refresh or turn auto-updates back on when you want to run a query.
For discrete dimension filter, you can enter custom value lists to avoid querying to fill a list of items in the filter dialog.
you can improve your performance by considering the following tips-
Use custom sql query in tableau to filter the data source to get the smaller working data.(data filtered at backend will be added advantage)
Hide unwanted fields from the data source pane.
Publish your data set to tableau server and then connect the tde server extract to tableau.
I don't feel Tableau is the right tool for such a large data set. But check out this article on performance.
http://kb.tableau.com/articles/knowledgebase/database-query-performance

MS Access data lineage documentation

I am looking for a scripted/automated way (presumably VBA?) to take an Access query and generate some kind of savable, searchable, publish-able documentation on the data lineage. So if there were a bunch of layered/nested queries, or even passthrough queries, along the way I want a way to trace the final fields in the specified query back until I get back to the original source tables/fields.
Everything I've found seems to do database documentation focused on how the table relationships are configured. I'm looking for a way to get the documentation of the user-created portion, down to the field. I'm very open-minded on what format the output is in. I'm convinced this must be possible, but haven't had any luck yet.
I'm also open to recommendations for a third-party application if it could do this.
Thanks in advance!
Access does have a built in “dependency” feature. The result is a VERY nice tree-view of those dependencies, and you can even launch such objects using that treeview of your application to “navigate” the application so to speak.
The option is found under database tools and is appropriately called Object Dependencies.
The result looks like this:
While you don't want to use auto correct, this feature will force on track changes. If this is a large application, then on first run a significant delay will occur. After that, the results can be viewed instantly. As noted, not only do you have a hierarchical tree view, but objects in the tree view can be clicked on to launch the object in question.
And the above will work for a query that based on a query etc. all the way down to the base table.
https://www.dropbox.com/sh/f73rs3h9u9q2xk5/AAArloN_Cmf_WbPZ4W75I6KVa?dl=0
This is a set of queries I wrote to provide the kind of documentation you're looking for. It seems a bit kludgy, but it works for me. It's not a simple as the other response, but it provides output that can be incorporated into other documentation.
Note - the documentation is out of date with respect to Union queries. The query I have to analyze Union queries seems to only pick up the 1st two things that go into the Union, so I changed this to a Make Table query, and manually edit the resulting table to add the missing relationships.
To use the queries:
Copy the table and all the queries into your database
Run the "Mapping Unions Make Table" query
Manually edit the Unions table if necessary
When you run any of the 3 main output queries, you are prompted for the Top object you want to analyze. Enter the name of a query or table to find all the dependencies for that object. The three main outputs are:
Mapping Summary - lists all of the objects that go into the top object and all of the objects that go into them, to a depth of about 10 (depth is controlled in the "Mapping all parents" query)
Mapping summary without duplicates
Mapping summary duplicates
I especially like the 2nd output - this is in a format that can be saved in Excel and input to Visio's Org Chart Wizard to get a simple graphical representation of the relationships. Then the 3rd output query can be used to manually add in the queries that go into more than one other query, which Visio's wizard cannot handle.

DataGridView population with variable WHERE clause (MySQL/Net Connector)

I am using the MySQL/Net Connector for my VS 2010 VB.NET application. I managed to automatically fill my DataGridView using the little operation arrow up over the DataGridView and it received data well.
Now the results are displaying properly; however, the results are divided into lists and the list should be selectable from a ComboBox - creating a where clause that filters the result only for results from the correct list.
It would be something like: WHERE list = ComboBox.Text.ToString
However the query is only within the xsd file and I don't see how I can get the value from my ComboBox into that query.
Is there a way to get the query into my Form.vb or anywhere where the ComboBox value is available? I feel like this should be possible...
And ideas? If you don't get me yet: Ask me. I might be hard to understand.

Query, Display, and Filter Large Database Lists

I am trying to determine the best method of collecting a large list from a database and then displaying and filtering the results on the client side. Let me give a quick example:
Example: I've got a database with customer data and currently it contains around 2000 records. This number is constantly increasing. On my website I have a page that I want to be able to query said database based on information such as name, email, phone number etc. and of course display the results (when a user types in Smith it returns all records containing the name Smith). I am planning on using AJAX so that I can query the database and display the results on the fly similar to how google does it. When a user begins searching, results will start showing up on the page as they are found.
Possible Solutions:
Unfortunately I am stumped on how to go about implementing something like this. I am considering using a ValueList pattern. When the user first loads the page, should I be querying the database and storing every record in a collection and then searching that collection list and displaying the results on my jsp page? Essentially creating a java database. The thing I like about the ValueList pattern is that I take one huge hit on page load and dump the entire database in objects stored in a list. What if the database is larger though, say 2,000,000 records?
Or should I be using a simple DOA pattern without the ValueList and query the database for each individual search? This would result in a LOT of database queries, especially considering that I plan on returning results as the user types in the search box.
Edit: The more I think about this, the more it is an AJAX question. My biggest concern should be how to query my database while the user is typing. Do I set some sort of listener to listen for the user to stop typing and then perform the query?
I would use Solr for this type of task.
Fields, which you are going to use for searching should be indexed with Solr.
Then you do an ajax query to Solr and get the result. You can set the order, number of items per page and show results only for current page.
Solr has a lot of other features that can be useful for you.