me.recordsource = me.recourdsource re-triggers notinlist event

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

My code is below.
When the event happens originally, apparently when it gets to the .
RecordSource line, it causes the NotInList event to refire. As I step through
it, it goes from the .RecordSource line back to the Private Sub line. Any
suggestions?

Private Sub cmbTermFinder_NotInList(NewData As String, Response As Integer)

DoCmd.SetWarnings False
dbLocal.Execute "INSERT INTO tblTerminology ( Term ) SELECT """ & NewData &
""" AS Term", dbFailOnError

'Tell Access you've added the value
Response = acDataErrAdded

DoCmd.SetWarnings True
With Me
.RecordSource = .RecordSource
.Requery
End With
With DoCmd
.GoToControl ("txtTERMID")
.FindRecord Me.cmbTermFinder.Column(0), acEntire, , acSearchAll, , acAll,
True
.GoToControl ("txtTerm")
End With
Me.cmbTermFinder = Null

End Sub
 
D

Douglas J. Steele

Why are you bothering with resetting the recordsource and requerying?
Setting Response = acDataErrAdded should do those things for you
automatically.
 
R

ragtopcaddy via AccessMonster.com

Douglas,

Thanks for the reply.

The reason for resetting the recordsource and requerying is that I'm getting
desperate! After the procedure, the continuous form doesn't show the added
record. But, if I type the newly added item in the combo box, it is no longer
"NotInList", although, because it doesn't appear in the subform, the
afterupdate routine can't find the record. The routine has no trouble finding
records that actually appear in the subform.

Regards,

Bill
Why are you bothering with resetting the recordsource and requerying?
Setting Response = acDataErrAdded should do those things for you
automatically.
My code is below.
When the event happens originally, apparently when it gets to the .
[quoted text clipped - 29 lines]

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 
D

Douglas J. Steele

Sounds as though you should be requerying the form, not the combo box.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


ragtopcaddy via AccessMonster.com said:
Douglas,

Thanks for the reply.

The reason for resetting the recordsource and requerying is that I'm
getting
desperate! After the procedure, the continuous form doesn't show the added
record. But, if I type the newly added item in the combo box, it is no
longer
"NotInList", although, because it doesn't appear in the subform, the
afterupdate routine can't find the record. The routine has no trouble
finding
records that actually appear in the subform.

Regards,

Bill
Why are you bothering with resetting the recordsource and requerying?
Setting Response = acDataErrAdded should do those things for you
automatically.
My code is below.
When the event happens originally, apparently when it gets to the .
[quoted text clipped - 29 lines]

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 

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

Top