Combo box is updating table properly when has new city to add on 'not in list' function. Problem is, when return to the box after the addition of the city, the rowsource is not showing the new entry (it's in the table, but the combo box does not show the new listing). I have no idea why the combo box will not update after the new city is added and it is driving me totally nuts. I have been trying for two weeks to get it to work. Someone please call or email me before I totally lose my mind. I know it is something simple I am overlooking, but I can't figure it out. email is ginastar@sonet.net or phone is 1-888-715-3622. <begging> please!! </begging> The query that the combo box is based on is very simple:
SELECT tblCity.strPerdiemCity FROM tblCity;
Actually, the table is very simple too, strPerdiemCity is the only field in it
Private Sub strPerdiemCity_NotInList(NewData As String, UserResponse As Integer)
'********************************************************************
' Name: strPerdiemCity_NotInList
' Author: Regina Parker
' Date: March 27, 2003
' Comment: If City not in list, add to list
'********************************************************************
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available City"
strMsg = strMsg & "@Do you want to quickly add the new City to the current list?"
strMsg = strMsg & "@Click Yes to add or No to re-type it."
If msgbox(strMsg, vbQuestion + vbYesNo, "Add new City?"
= vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblCity", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs![strPerdiemCity] = NewData
rs.Update
If Err Then
msgbox "An error occurred. Please try again."
Response = acDataErrContinue
Me![strPerdiemCity].Undo
Else
Response = acDataErrAdded
End If
End If
Exit_strPerdiemCity_NotInList:
Exit Sub
Err_strPerdiemCity_NotInList:
Select Case Err
Case 0
Case Else
msgbox Err.DESCRIPTION
Resume Exit_strPerdiemCity_NotInList
End Select
End Sub
SELECT tblCity.strPerdiemCity FROM tblCity;
Actually, the table is very simple too, strPerdiemCity is the only field in it
Private Sub strPerdiemCity_NotInList(NewData As String, UserResponse As Integer)
'********************************************************************
' Name: strPerdiemCity_NotInList
' Author: Regina Parker
' Date: March 27, 2003
' Comment: If City not in list, add to list
'********************************************************************
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available City"
strMsg = strMsg & "@Do you want to quickly add the new City to the current list?"
strMsg = strMsg & "@Click Yes to add or No to re-type it."
If msgbox(strMsg, vbQuestion + vbYesNo, "Add new City?"
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblCity", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs![strPerdiemCity] = NewData
rs.Update
If Err Then
msgbox "An error occurred. Please try again."
Response = acDataErrContinue
Me![strPerdiemCity].Undo
Else
Response = acDataErrAdded
End If
End If
Exit_strPerdiemCity_NotInList:
Exit Sub
Err_strPerdiemCity_NotInList:
Select Case Err
Case 0
Case Else
msgbox Err.DESCRIPTION
Resume Exit_strPerdiemCity_NotInList
End Select
End Sub