• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Refresh Access Query Data

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
Bob_Collison
Asked:
Bob_Collison
2 Solutions
 
Kelvin SparksCommented:
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
 
Gustav BrockCIOCommented:
You can run this code in the AfterInsert (or AfterUpdate) event of the form:

    Me!cboYourCombobox.Requery

/gustav
0
 
Mike EghtebasDatabase and Application DeveloperCommented:
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
 
Bob_CollisonAuthor Commented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now