G
Guest
I've seen similar messages on this list, but I still seem to be missing something
On a BANK form I have a combo box called CountryCombo that includes a list of countries from a Country table. I have CountryCombo set to Limit-to-List and then for the event On Not in List, I call the following code
Private Sub COUNTRYCombo_NotInList(NewData As String, Response As Integer
UserAnswer = MsgBox("You have tried to enter a country not in the database. Do you which to add that country to the database?", vbYesNo, "Missing Country Warning"
If UserAnswer = vbYes The
DoCmd.OpenForm "Countries", , , , acFormAdd, acDialo
Els
Me.CountryCombo = Nul
End I
End Su
This code seems to work. But after I close the Countries form, the CountryCombo does not list the new country. I know I need to some how Requery the combo box, but I've tried several approaches. I usually get an error message after the Countries form closes and the focus returns to the BANK form--Error 2118 "You must save current field before you run requery action
For the Requery, I have tried CountryCombo.Requery and Me!CountryCombo.Requery and even Forms![Bank]![CountryCombo].Requer
A related question is where (what event) to put the request for the Requery code? Right now the requery code is called by the CountryCombo's On Got Focus event
Any help would be appreciated. Please be explicite!
On a BANK form I have a combo box called CountryCombo that includes a list of countries from a Country table. I have CountryCombo set to Limit-to-List and then for the event On Not in List, I call the following code
Private Sub COUNTRYCombo_NotInList(NewData As String, Response As Integer
UserAnswer = MsgBox("You have tried to enter a country not in the database. Do you which to add that country to the database?", vbYesNo, "Missing Country Warning"
If UserAnswer = vbYes The
DoCmd.OpenForm "Countries", , , , acFormAdd, acDialo
Els
Me.CountryCombo = Nul
End I
End Su
This code seems to work. But after I close the Countries form, the CountryCombo does not list the new country. I know I need to some how Requery the combo box, but I've tried several approaches. I usually get an error message after the Countries form closes and the focus returns to the BANK form--Error 2118 "You must save current field before you run requery action
For the Requery, I have tried CountryCombo.Requery and Me!CountryCombo.Requery and even Forms![Bank]![CountryCombo].Requer
A related question is where (what event) to put the request for the Requery code? Right now the requery code is called by the CountryCombo's On Got Focus event
Any help would be appreciated. Please be explicite!