Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Drop-down value does not get updated

Posted on 2014-03-23
4
Medium Priority
?
797 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1260 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 39

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

722 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