field update threw a combobox

R

Ran BD

guys i'm trying to use a not in list property to update a field called
Custname inside a comboBox
i'm using the folowing code and i'm geeting an error 91.
the debugger stops next to the line marked with -->

any idea ?

Private Sub CustNameCombo_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String

strMsg = "'" & NewData & "' ?? ????? ?????? ?º???? " & vbCrLf & vbCrLf
strMsg = strMsg & "??? ?????? ?????? ?º?? ??? ??????"
strMsg = strMsg & vbCrLf & vbCrLf & "??? ?? YES ??????, ??? ?? NO ??????
??????."

If MsgBox(strMsg, vbQuestion + vbYesNo, "??? ?????? ???????") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
---> Set rs = db.OpenRecordset("Cust_Tbl", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AEName = 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
 
R

Ran BD

the table name is Cust_TbL
as i wrote that is not it could you tell me what is error 91
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top