Using a Combo Box for Filtering a Continous Form

V

VWP1

I have been unsuccessful at filtering one field in a continuous form
using a dropdown combo box instead of a button. I have
20 accounts, and the quantity of accounts is dynamic, so buttons
would be impractical, as some accounts become deleted, and
new accounts are created weekly
Given:
1. a continuous form named: f_ck_mstr_list
2. The form is fed by a SELECT statement from a table of
personal check account data:
The table holds normal checking data,
but can hold limitless accounts as well as
their respective checks because of the field named:
fn_bnk_xa_ck_acct_

3. [filter_acct_] is the unbound combo box name, and it:
...is located in the form footer.
...is fed by a query, using the same AutoNumber field acctID.
...is being used as a filtering dropdown menu
4. [fn_bnk_xa_ck_acct_] is a AutoNumber field ID using acctID
(not the actual bank account number)

The Goal:
to use the dropdown combo box to filter the master list of checks to just
the account matching the dropdown combo box selection),
and to re-filter by choosing another account from teh combo box


Private Sub filter_acct__AfterUpdate()
On Error GoTo Err_filter_acct__AfterUpdate

Me.Filter = "[fn_bnk_xa_ck_acct_] = [filter_acct_]"

Me.FilterOn = True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_filter_acct__AfterUpdate:
Exit Sub

Err_filter_acct__AfterUpdate:
MsgBox Err.Description
Resume Exit_filter_acct__AfterUpdate

End Sub
 
V

VWP1

Thank you very much!

Marshall Barton said:
VWP1 said:
I have been unsuccessful at filtering one field in a continuous form
using a dropdown combo box instead of a button. I have
20 accounts, and the quantity of accounts is dynamic, so buttons
would be impractical, as some accounts become deleted, and
new accounts are created weekly
Given:
1. a continuous form named: f_ck_mstr_list
2. The form is fed by a SELECT statement from a table of
personal check account data:
The table holds normal checking data,
but can hold limitless accounts as well as
their respective checks because of the field named:
fn_bnk_xa_ck_acct_

3. [filter_acct_] is the unbound combo box name, and it:
...is located in the form footer.
...is fed by a query, using the same AutoNumber field acctID.
...is being used as a filtering dropdown menu
4. [fn_bnk_xa_ck_acct_] is a AutoNumber field ID using acctID
(not the actual bank account number)

The Goal:
to use the dropdown combo box to filter the master list of checks to just
the account matching the dropdown combo box selection),
and to re-filter by choosing another account from teh combo box


Private Sub filter_acct__AfterUpdate()
On Error GoTo Err_filter_acct__AfterUpdate

Me.Filter = "[fn_bnk_xa_ck_acct_] = [filter_acct_]"

Me.FilterOn = True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_filter_acct__AfterUpdate:
Exit Sub

Err_filter_acct__AfterUpdate:
MsgBox Err.Description
Resume Exit_filter_acct__AfterUpdate

End Sub


The value you want to filter for needs to be outside the
quotes:

Me.Filter = "[fn_bnk_xa_ck_acct_] = " & Me.[filter_acct_]
Me.FilterOn = True

I don't remember what that DoMenuItem thingie is supposed to
do, but I doublt that it needed. Just because some outdated
wizard used it doesn't mean it is the right thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top