M
maura
I have researched Adding to List and from the Access Web got this code and
modified it for my purposes, however I am getting an error 91, when I debug
it comes back to
rs.close ((this is what it is saying is the problem))
********
' Code Courtesy of
' Dev Ashish
********
Private Sub combo82_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Color " & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to associate the NEW COLOR to the current
COLOR LIST?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to ADD NEW COLOR or No to
re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblColor", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Color = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
_____________________________
Any suggestions as to why I am getting this error??? Thanks, m.
modified it for my purposes, however I am getting an error 91, when I debug
it comes back to
rs.close ((this is what it is saying is the problem))
********
' Code Courtesy of
' Dev Ashish
********
Private Sub combo82_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Color " & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to associate the NEW COLOR to the current
COLOR LIST?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to ADD NEW COLOR or No to
re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblColor", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Color = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
_____________________________
Any suggestions as to why I am getting this error??? Thanks, m.