Hi,
There's a couple of threads around concerning storage of user entered values in combo boxes but none seem to correspond to my new problem.
I've managed to find and amend some code so that the user is prompted if they want to add their value to the combo box. The code is thus:
Private Sub Course_Type_NotInList(NewData As String, Response As Integer)
Dim intMsgBox As Integer
Dim strData, quotes As String
quotes = Chr(34)
strData = Trim$(NewData)
intMsgBox = MsgBox("""" + strData + """" + " does not appear in the database. Do you want to add it now?", vbQuestion + vbYesNo)
If intMsgBox = vbYes Then
[Course Type].RowSource = [Course Type].RowSource & ";" & quotes & strData & quotes
Response = acDataErrAdded
End If
End Sub
The problem is, it's not permanent. Once the form has exited, the addition is lost.
I think maybe the problem is I need to change the row source of the field [Course Type]in the Table tblCourses which is what the form frmCourses is based on but I can't remember how to refer to it!
If that's not it (which it probably isn't) does anyone know what it is?
Cheers,
Pete
There's a couple of threads around concerning storage of user entered values in combo boxes but none seem to correspond to my new problem.
I've managed to find and amend some code so that the user is prompted if they want to add their value to the combo box. The code is thus:
Private Sub Course_Type_NotInList(NewData As String, Response As Integer)
Dim intMsgBox As Integer
Dim strData, quotes As String
quotes = Chr(34)
strData = Trim$(NewData)
intMsgBox = MsgBox("""" + strData + """" + " does not appear in the database. Do you want to add it now?", vbQuestion + vbYesNo)
If intMsgBox = vbYes Then
[Course Type].RowSource = [Course Type].RowSource & ";" & quotes & strData & quotes
Response = acDataErrAdded
End If
End Sub
The problem is, it's not permanent. Once the form has exited, the addition is lost.
I think maybe the problem is I need to change the row source of the field [Course Type]in the Table tblCourses which is what the form frmCourses is based on but I can't remember how to refer to it!
If that's not it (which it probably isn't) does anyone know what it is?
Cheers,
Pete