OnClick to Requery a Combobox

SirStevie3

Registered User.
Local time
Today, 15:16
Joined
Jul 29, 2013
Messages
58
I want a command button to "Requery" a combobox. the combobox uses a query to determine the records listed (it lists incomplete records). after completing the record, i'd like to hit a command button that will "requery" the combobox so that the recently completed record is no longer listed.

i tried this:

me.nameofcombobox.requery

but the completed record was still listed.

beyond that i dont know what to try. i am a vba noob, hence the quotes around "requery" as im not sure that is the correct term to be using in this context.

Thanks for any help/suggestions!!
 
Are you sure that the changes to the record in question have been propagated back to the table? My bet is that you need to save the current record, then requery the combo.
Do . . .
Code:
Me.Dirty = False
. . . or . . .
Code:
Me.Refresh
. . . or . . .
Code:
docmd.RunCommand acCmdSave
. . . to save the current edits before running the requery and see if it works.
 
Thanks for the help lagbolt!!

with a little experimentation with the info you gave me i ended up using this on the command button's onclick event:

Private Sub Command9_Click()
DoCmd.RunCommand acCmdSave
Me.nameofcombobox.Value = Null
Me.nameofcombobox.Requery
End Sub
 
Great. Nicely done. Thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom