P
Perico
I have a form where the default view is datasheet (not
sure that matters.) One of the field controls is a combo
box. I use the standard "Not in List" code below. I
notice when I respond "yes" to add to the list, it works
fine, however after I enter the data in that first row and
I move to the next row, the data for that field is entered
again in the second row. What is causing this duplication?
Here's my code:
'Private Sub SchName_NotInList(NewData As String, Response
As Integer)
' Dim strMsg As String
''PROBLEM - THIS ADDS TWICE
' strMsg = "'" & NewData & "' is not in the list. "
' strMsg = strMsg & "Would you like to add it?"
' If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, _
' "New School") Then
' Response = acDataErrDisplay
' Else
' Dim rst As Recordset
' Dim db As Database
' Set db = CurrentDb()
' Set rst = db.OpenRecordset("tblSchool")
' rst.AddNew
' rst!SchName = NewData
' rst.Update
' Response = acDataErrAdded
' End If
'End Sub
sure that matters.) One of the field controls is a combo
box. I use the standard "Not in List" code below. I
notice when I respond "yes" to add to the list, it works
fine, however after I enter the data in that first row and
I move to the next row, the data for that field is entered
again in the second row. What is causing this duplication?
Here's my code:
'Private Sub SchName_NotInList(NewData As String, Response
As Integer)
' Dim strMsg As String
''PROBLEM - THIS ADDS TWICE
' strMsg = "'" & NewData & "' is not in the list. "
' strMsg = strMsg & "Would you like to add it?"
' If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, _
' "New School") Then
' Response = acDataErrDisplay
' Else
' Dim rst As Recordset
' Dim db As Database
' Set db = CurrentDb()
' Set rst = db.OpenRecordset("tblSchool")
' rst.AddNew
' rst!SchName = NewData
' rst.Update
' Response = acDataErrAdded
' End If
'End Sub