Solved

Refresh Access Query Data

Posted on 2014-11-15
5
505 Views
Last Modified: 2014-11-17
I have a Form with a ComboBox that uses a Select Query to select data to be used to create a new record in a table[REGISTRATION].  The query uses the same table [REGISTRATION] that I am creating the new record in.  Once I select an option in the ComboBox and save the record containing it to the table [REGISTRATION], I don't want it to be available again in the ComboBox.

If I close and reopen the Form the new record in the table [REGISTRATION] no longer displays in the ComboBox which is what I want.

How do I get this to happen without closing and reopening the Form?
0
Comment
Question by:Bob_Collison
[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
5 Comments
 
LVL 22

Assisted Solution

by:Kelvin Sparks
Kelvin Sparks earned 250 total points
ID: 40445003
Try using this code in the after update event of the form

Me.comboname.Eequery

replace comboname with the name of the combo box.

Kelvin
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 40445005
You can run this code in the AfterInsert (or AfterUpdate) event of the form:

    Me!cboYourCombobox.Requery

/gustav
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40445235
To your table, add a Yes/No field called RegisteredYN. Add this field (RegisteredYN) to your combo box rowsource. Set its criteria to false in the query feeding the combo box.

Additionally, add RegisteredYN also to your form (you can keep it visible or invisible). However when registration is complete, up on saving the competed registration have:

Me!RegisteredYN = True

This way, a registered record will not show up again in your combo box.

You also need to add the following to the OnEnter event of your combo box:

Me!cboMyComboBox.Requery

Mike
0
 

Author Closing Comment

by:Bob_Collison
ID: 40448582
I selected the two solutions because they are virtually identical (as I assume the first had a typo of eequery). and they are the simplest to implement.  I didn't try Mikes but it appears it would work but is much more complicated.
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

In this post we will learn different types of Android Layout and some basics of an Android App.
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.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

739 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