Main form refresh problem

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

Guest

Hi

I have a main People form controlled by a combo box. I also have button
which opens a popup to allow the users to enter a new person.

In the on close event of the popup box i have written code so that i picks
the person just added in the combo box. The problem is that the main form
doesn't refresh to show the persons info.

According the access 2000 helpfile this is because me after update event in
the combo box will not be triggered if i enter the data using vb code.

Does anyone know how i can work round this problem?

Thanks

Gillian
 
In the AfterUpdate event of your popup *form* (not the AfterUpdate of a
control), requery the combo on the previous form so it gets to hear about
the new entry.

This kind of thing:
Private Sub Form_AfterUpdate()
Forms!Form1.Combo2.Requery
End Sub
 
It matters not whether the original form (the one with the combo) is
unbound, since it is the combo that is being requeried.

If your popup form is also unbound, you cannot use its AfterUpdate event.
Use whatever event actually adds the data to the combo's RowSource table.
 
Hi

The main form is bound but the popup isn't. The user enter the information
for the new person in the popup and then presses the create button.

The onclick of the create button runs an append query.

The code i currently have gets the popup to close and the main form to
display the newly added record in the combo box, but because the main form
hasn't actually refreshed the data shown in the body of the form is wrong.

Gillian
 
Clicking the Create button is what adds the new record?
Use that event to perform the requery as well.

You are wanting the *record* to show up in the first form, not just in the
combo's list? In that case you will need to Requery the form instead of the
combo, and it may not work in the form is dirty at the time. if you have
partially filled out a record that cannot be saved yet, then that has to
happen before it can be requeried to discover the other record you just
added.
 
I have managed to get the new record created in the popup to be the picked
entry in the combo box.

I can't get the main form to refresh to show the data in the combo box on
the main form because according to the access help a requery event won't be
triggered if the data has been forced into the combo usnig code.

I can't see any way to now get this to working without the user repicking
the select person from the combo to force a refresh.

Gillian
 
Back
Top