NotinList should work, why doesn't it?

  • Thread starter Thread starter OceanView
  • Start date Start date
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
 
---------- 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
 
Back
Top