Code: Select all
Private Sub SelectProgram_NotInList(NewData As String, Response As Integer)
If MsgBox("""" & NewData & """ does not occur in the list of programs." & vbCrLf & _
"Do you want to add it?", vbYesNo + vbQuestion) = vbYes Then
CurrentDb.Execute "INSERT INTO Programs (ProgramName) VALUES(""" & NewData & """)", dbFailOnError
Response = acDataErrAdded
Else
MsgBox "Please select a program from the list!", vbExclamation
Response = acDataErrContinue
End If
End Sub
The normal action is that a Program is selected in the Select Program unbound combo box which populates the Program Name text box and activates that record in the form and subform. When a Not-In-List title is typed into the combo box, and the above code runs, the new title is added to the Program table but nothing changes in the form so the Viewings subform is not available.
Thanks,
- Jeff