Hi,,
I want to know the code for Filter table records based on form combobox value. the table is not in Form. Below code not working:
[Table_name]![field1].filter= Forms.[Form_Name].[Combo1]
Hi,,
I want to know the code for Filter table records based on form combobox value. the table is not in Form. Below code not working:
[Table_name]![field1].filter= Forms.[Form_Name].[Combo1]
See this thread:
https://www.pcreview.co.uk/threads/v...cords.2211492/
I don't recommend letting your users work directly in the tables. For
one thing, you have much less control. Why not create a continuous form
(or even a datasheet form) bound to this table; then you can open it
and supply the where-condition at the same time via the DoCmd.OpenForm
method.
If you insist on opening the table directly, there's no way to filter it
in the same statement that opens it. However, you can filter it in the
very next statement, like this:
Dim strCustomerWanted As String
strCustomerWanted = "Martin Lee"
Docmd.OpenTable "Customer Inf"
DoCmd.ApplyFilter , "[customer name]=" & _
Chr(34) & strCustomerWanted & Chr(34)
Note the comma that immediately follows the name of the ApplyFilter
method. That's critical, because it distinguishes the optional
"FilterName" argument (which we're not using) from the "WhereCondition"
argument (which we are using).
In main form, I have button to compare between some tables. and before compare, I need to make filter based on Form combobox. There are many tables need to compare, those tables not in Main or sub form.
Not much context in your post as to what you want to do with the many tables except to compare a value in the tables with a value in a form's combobox.I have button to compare between some tables.
Based on that, what about a DLookup for each table?