Solved

Drop-down value does not get updated

Posted on 2014-03-23
4
775 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 34

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now