Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NotInList Event in Access 2002

Status
Not open for further replies.

shortone

Programmer
Mar 6, 2002
45
US
Hi!
I've had the code below work beautifully until we upgraded to Office XP, now I can't seem to suppress the standard Access message "The text you entered, blah, blah, blah." I copied it exactly from a previous form, but now it doesn't work. Does anyone know if "acDataErrContinue" and "acDataErrAdded" still works in Access 2002, or has it been replaced with something else? This has been driving me nuts!


Code:
Private Sub School_NotInList(NewData As String, Response As Integer)

On Error GoTo Err_School_NotInList
    Dim db As Database
                  
    If MsgBox("School or building is not on the list." & vbCr & " Would you like to add it?", _
        vbYesNo Or vbQuestion, "Unknown School or Building Name") = vbYes Then
        Set db = CurrentDb()
        db.Execute "INSERT INTO DistrictInfo (School) Values ('" & NewData & "');"
        Set db = Nothing
    Response = acDataErrAdded
    Else
    Response = acDataErrContinue
    End If
Exit_School_NotInList:
    Exit Sub
Err_School_NotInList:
    MsgBox Err.Number & "" & Err.Description, vbInformation, "Not in list"
    Resume Exit_School_NotInList
        
End Sub

Thanks in advance![bugeyed] JayeD
"I'm sure of two things: there IS a God, and I'm NOT Him!" - R. Williams
 
--------------------------------------------------------------------------------
I just remembered that the School control is based upon a query that limits the choices to just those schools in the particular district chosen. Would that affect the "NotInList" code in any way? [ponder] JayeD
"I'm sure of two things: there IS a God, and I'm NOT Him!" - R. Williams
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top