B
basiltabethacat
Hi,
I'm writing a database to help teachers write Unit Plans, containing several
tabs of hierarchical information, both within the tabs and between the tabs.
I'm trying to use a combo box to display current choices, but allow the user
to start a brand new Unit Plan (a relational table upon which many other
choices and related information and tables will hinge and be added to.
My form fields/Associated table fields
cboPlanName/PlanName
txtYearOfTeaching/TermYear
txtTermNumber/Term/Number
The code I have placed into the "Not in List" event is:
Private Sub cboPlanName_NotInList(NewData As String, Response As Integer)
Dim msgstr As String
msgstr = "You have entered a new Unit Plan name. Do you really want to
begin a new Unit Plan?"
If MsgBox(msgstr, vbYesNo, "Create new Unit Plan?") = vbYes Then
Response = acDataErrAdded
CurrentDb.Execute ("INSERT INTO [Term Plans](PlanName) SELECT '" &
NewData & "' AS Expr1;")
Else
repsonse = acDataErrContinue
Me.cboPlanName.Undo
End If
End Sub
Although I have placed the acDataErrAdded and acDataErrContinue commands, the
MS generic error messages still persist. I want my cbo box to save the new
entry, and then if vbYes, enable and null the text boxes, ready for the user
to enter the associated information to complete the record, if vbNo return
the user to the cbo box to make another choice with no info saved.
I'm an absolute beginner. I sort of understand what all the code does except
for the actual execution code, which is, of course, copied and adapted (any
suggested tutorials regarding this aspect would be appreciated).
Why do I still get the MS generic error messages?
I'm writing a database to help teachers write Unit Plans, containing several
tabs of hierarchical information, both within the tabs and between the tabs.
I'm trying to use a combo box to display current choices, but allow the user
to start a brand new Unit Plan (a relational table upon which many other
choices and related information and tables will hinge and be added to.
My form fields/Associated table fields
cboPlanName/PlanName
txtYearOfTeaching/TermYear
txtTermNumber/Term/Number
The code I have placed into the "Not in List" event is:
Private Sub cboPlanName_NotInList(NewData As String, Response As Integer)
Dim msgstr As String
msgstr = "You have entered a new Unit Plan name. Do you really want to
begin a new Unit Plan?"
If MsgBox(msgstr, vbYesNo, "Create new Unit Plan?") = vbYes Then
Response = acDataErrAdded
CurrentDb.Execute ("INSERT INTO [Term Plans](PlanName) SELECT '" &
NewData & "' AS Expr1;")
Else
repsonse = acDataErrContinue
Me.cboPlanName.Undo
End If
End Sub
Although I have placed the acDataErrAdded and acDataErrContinue commands, the
MS generic error messages still persist. I want my cbo box to save the new
entry, and then if vbYes, enable and null the text boxes, ready for the user
to enter the associated information to complete the record, if vbNo return
the user to the cbo box to make another choice with no info saved.
I'm an absolute beginner. I sort of understand what all the code does except
for the actual execution code, which is, of course, copied and adapted (any
suggested tutorials regarding this aspect would be appreciated).
Why do I still get the MS generic error messages?