NotinList should work, why doesn't it?

O

OceanView

Why doesn't this work?

The control txtDaddr is a combobox with a recordset, rsaddress, as
it's source. When I type a new data string and the notinlist event
fires, the addnew works, but I still get a notinlist error, even
though I do a requery and the data WAS added. Why?

Private Sub txtDaddr_NotInList(NewData As String, Response As
Integer)
On Error Resume Next
update_address rsaddress, "address", NewData
txtDaddr.Requery
Response = Access.acDataErrAdded
End Sub

Sub update_address(rs As adodb.Recordset, strFieldName As String,
strData As String)
On Error Resume Next
rs.AddNew strFieldName, strData
rs.Update
End Sub
 
E

Emilia Maxim

---------- OceanView said:
The control txtDaddr is a combobox with a recordset, rsaddress, as
it's source. When I type a new data string and the notinlist event
fires, the addnew works, but I still get a notinlist error, even
though I do a requery and the data WAS added. Why?

Private Sub txtDaddr_NotInList(NewData As String, Response As
Integer)
On Error Resume Next
update_address rsaddress, "address", NewData
txtDaddr.Requery
Response = Access.acDataErrAdded
End Sub

Ocean,

it might be the Requery statement. You don't need that, setting the
response to acDataErrAdded tells Access it must reload the combo.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 

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