Main form refresh problem

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
 
A

Allen Browne

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
 
A

Allen Browne

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.
 
G

Guest

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
 
A

Allen Browne

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.
 
G

Guest

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
 

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

Top