Is there a way to filter tables in a Database with only VB Code, or do you have to use the queries? If this is possible I would like to eliminate my queries and filter the tables in my database with just code. I would also like the results to be output to a new table in the database and maybe to an excel file. I have no idea how this would work, so I will need alot of help if this is possible. I would like to use my form to still pass the values in.
Filter table from VB Code
Collapse
X
-
Basically You need a query with criteria to filter a table.
Changing such a query into a MakeTable query will create a filtered copy.
Filtering from code is done on a form, e.g. a master form with a datasheet subform.
There the right-click (also usable on a table) can be used to filter with an AND relation, or the FilterByForm button when an OR relation is needed.
In code you can also apply a filter with:
Me.subformname. form.filter = "ID=" & me.ID
Me.subformname. form.filteron = True
Such a filter (and a right-click filter) can be added as a WHERE clause to a query created in code.
Nic;o) -
Although you could implement a sort of filtering in VB code it would not serve your purpose well. The result would only be available to your code for a start, which would need to be developed further to output the results somewhere accessible. It really has many drawbacks, not least of which is the inefficient execution.Originally posted by ChaseCoxIs there a way to filter tables in a Database with only VB Code, or do you have to use the queries? If this is possible I would like to eliminate my queries and filter the tables in my database with just code. I would also like the results to be output to a new table in the database and maybe to an excel file. I have no idea how this would work, so I will need alot of help if this is possible. I would like to use my form to still pass the values in.
I'm curious as to why you would want to bypass one of the (possibly the most) fundamental tools of database manipulation and processing?Comment
Comment