Updating a Combo Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I only learned hoe to do this last week and have had a couple of success'
but this one just won't work. Can anyone tell me what I've done wrong.

I am tryimg to automatically requery a combo box on form when the form is
closed.

Form = Suppliers (this is the form I put the code into. (Event Procedure "On
Close")
Form = 1Purchase Orders
Combo Box = Supplier

Private Sub Form_Close()

On Error Resume Next
Forms!1Purchase_Orders!Supplier.Requery

End Sub
 
pjd said:
Hi

I only learned hoe to do this last week and have had a couple of
success' but this one just won't work. Can anyone tell me what I've
done wrong.

I am tryimg to automatically requery a combo box on form when the
form is closed.

Form = Suppliers (this is the form I put the code into. (Event
Procedure "On Close")
Form = 1Purchase Orders
Combo Box = Supplier

Private Sub Form_Close()

On Error Resume Next
Forms!1Purchase_Orders!Supplier.Requery

End Sub

Could be your form reference is at fault. Try

Forms![1Purchase Orders]!Supplier.Requery

I don't recommend embedding spaces or other non-standard characters in
object names, because it forces you to use square brackets to "quote"
the name.
 
Since you're doing this in the Close event, is it clear that the combo box
is still available to be requeried? And why do it at all? The combo box will
be requeried the next time you open the form anyway. Are you sure you don't
need to be requerying in the Current event? That's a much more common
situation.
 
Dave M said:
Since you're doing this in the Close event, is it clear that the
combo box is still available to be requeried? And why do it at all?
The combo box will be requeried the next time you open the form
anyway. Are you sure you don't need to be requerying in the Current
event? That's a much more common situation.

pjd is requerying a combo box on one form from the close event of a
different form.
 
Thanks, the brackets worked!

I'll take the advice regarding naming protocols on board.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top