New Entry to Pop-Up Entry Form

H

hfreedman

Hi,
I have a combo box in my form which selects property records from a table.
Upon selection, several fields are displayed on the form from the selected
record. These fields are non-editable. I want the user to be able to enter a
new property name in the combo-box which will pop-up my form for creating new
properties. I created a macro to open the creating property form. In the main
form, I'm using the NotInList event to call the macro. So far so good.
Unfortunatelty, when the create property form pops-up, and the new property
is added, that new property is not available in the drop down list unless I
close the main form then open it up again. i hope this is clear. Any
suggestions? Thanks!
 
A

Allen Browne

The NotInList event is useful where the NewData added to the combo goes into
its BoundColumn. Since you have an entire new property to enter, I am
guessing that the Bound Column is zero-width, and so this approach will not
work.

Instead, you could use (say) the DblClick event of the combo to pop up the
form where the new property is entered. Then in the AfterUpdate event of
this form, requery the combo on the previous form, so it gets to hear about
the new/changed property:
Private Sub Form_AfterUpdate()
Forms![YourOtherFormNameHere]![YourComboNameHere].Requery
End Sub

Notes:
a) If the combo already has a bad entry, it may be necessary to Undo it
first.

b) You probably want to check if the other form is open first.

c) You might want to use the AfterDelConfirm event of the form as well, in
case the user deletes a property.
 

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