requery a non-query item? combobox issue.

wiklendt

i recommend chocolate
Local time
Tomorrow, 07:46
Joined
Mar 10, 2008
Messages
1,746
hi it's me again!

i have a combobox who's rowsource is a table (listing suburbs) on a main form. when user wants to enter address with a non-existing suburb, i use a comand button to open a different form specifically only to enter a new suburb.

when i enter the new data, and close the form (using a comand button), i'd like to have the combobox display this new entry straight away. at the moment, i have to close and re-open the main form before the new entry will display in the combobox.

however, requery doesn't seem to do the trick... i presume because it's based on a table not a query? is there such a thing as 'refresh' for this type of thing? or am i going about it all entirely wrongly...?

cheers,
wiklendt.
 
The requery should work. Where did you place the vb code to requery
the combo box? This command should be issued on closing the form used
to enter the new suburb.
 
ok, i'll have another look - i may have put the code in the wrong place...
 
From a button on your main form, you should have something like this:

Code:
Private Sub AddSuburbButton_Click()
  DoCmd.OpenForm "YourAddSuburbFormName", , , , , acDialog
  YourCombobox.Requery
End Sub

By opening the second form in Dialog mode, using acDialog, you force Access to halt execution of the combobox requiry code until after the suburban form is closed. If you don't do this, the combobox will be requeried before the new suburb is added and saved.
 
Missingling

Thank you, that is just what I was looking for.
 

Users who are viewing this thread

Back
Top Bottom