Solved

Drop-down value does not get updated

Posted on 2014-03-23
4
787 Views
Last Modified: 2014-03-23
Budget Year SelectionBudget Account Selection Query based on BudgetYear variableHi,
  I have a custom Microsoft Access program to handle budget spending.
  In that program, I have a drop-down box for users to pick the budget year and it is NOT tied to a field in the table. It is a variable on the form. I am just using it in the query that is run when user clicks on "Select Account" drop-down menu (see the query screenshots above).

After I choose any budget year from "Select Budget Year" drop-down and click "Select Account" drop-down, it displays budget account numbers that belong to currently selected budget year in the "Select Budget Year" drop-down.
However If I change the budget year in the "Select Budget Year" drop-down and click  "Select Account" drop-down, then it still displays old budget year account information.

 In other word, my query does NOT grab newly changed value from  "Select Budget Year" drop-down. I think it is because it is a variable on the form, not tied to actual field on the table.

 How do I fix that so that every user selects different year, it will be reflected in my query.

Here are control names:
Select Budget Year Drop-Down: VarBudgetYear1
Select Account Drop-Down: Combo111

Thanks.
0
Comment
Question by:sglee
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 315 total points
ID: 39949147
You need to add code to the After Update event of the Budget Year drop-down:

Private Sub VarBudgetYear1_AfterUpdate()
    Me.Combo111.Requery
End Sub

Open in new window

0
 

Author Comment

by:sglee
ID: 39949177
It works like a charm!
Why was it necessary to re-query Combo111?
0
 
LVL 36

Expert Comment

by:PatHartman
ID: 39949198
When the form loads, the recordsets to populate the form and combos are created in memory.  To get a different set of data, you must rerun the query and that is what .Requery is doing.
0
 

Author Comment

by:sglee
ID: 39949206
Thanks.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question