Repainting list boxes

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a form with a list box of customers. I have a button to create a new
customer, and this goes to another form where the user enters the new
customer's name. When returning to the first form, I want the list box to be
updated with the new customer's name. I have lstCustomers.Requiry in the
first form's Form_Activate. I've tried adding Me.Repaint and Me.Refresh in
that same Form_Activate after the requiry, but nothing seems to make it
repaint automatically. If I click somewhere on the form, the list box
updates, but I want it to do it automatically. How do I do this?
 
Hi Dan,

You might try this...

First, open your input form as modal. Then when control returns to the
display form do your requery of the list box, e.g. Lbx.Requery. If the
record has been saved to the recordset you are querying for your List Box, it
should appear as expected without any other effort.

Example:

Private Sub GetInputBtn_Click()

DoCmd.OpenForm "InputFormName", , , , acFormAdd, acDialog
Me.Lbx.Requery

End Sub

Best...
MPM
 
Back
Top