Re: Refresh Recordset after NotInList update

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Albert D. Kallal (pleasenonosspammkallal_at_msn.com)
Date: 03/25/04


Date: Thu, 25 Mar 2004 10:20:27 -0700

You seem to left out the detail that this is combo box to "move to" or
search for a new record. We are also to assume that this combo box is
un-bound...right? (again, this info was/is needed).

To show any new records added on a form via code, you have to requery the
form (me.requery). You could try using a me.requery, but I don't think it
will work while the notinlist event has been fired.

(so, try placing a me.Requery in the notinlist code if a new record is
added..but as mentioned...you can't really requery a whole form while in the
middle of a combo box selection!

So, if the above does not work, then I would thus try setting some flag in
the notinlist event, and then in the combo after update event, I would try
the following:

in notinList, I would use a forms level flag, and a forms level var call
NewTrans

> Set rst = db.OpenRecordset(sqlTransRef, dbOpenDynaset)
> rst.AddNew
> rst!TransRef = NewData
> rst.Update

      NewTrans = NewData
      bolMyAdded = True

Then, in the after update

if bolMyAdded = True then
   ' seach/move to new reocrd.
   me.Requery
   me.cmbTransRef = NewTrans
end if

 ' your other remaing code here in the combo after update event that moves
to the correct record can follow...

--
Albert D. Kallal        (MVP)
Edmonton, Alberta Canada
pleasenonoSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn


Relevant Pages

  • Re: Not In List - Error 2118
    ... attempts failed when placing the code in the NotInList event. ... > A Response of acDataErrAdded tells the comobox to requery its row source ... > Private Sub cbo_NotInList ...
    (microsoft.public.access.formscoding)
  • Re: Not In List - Error 2118
    ... I'll redo the NotInList event code. ... > A Response of acDataErrAdded tells the comobox to requery its row source ... > Private Sub cbo_NotInList ...
    (microsoft.public.access.formscoding)
  • Re: "save" button not requerying as coded
    ... When the NotInList event fires, the message box pops up correctly, and the "No" button works correctly. ... If I click "end" instead of "debug" the frmNewFamily window opens with the new last name entered in the appropriate place. ... On a side note - why would you not navigate to a different control with this event? ... It's not necessary to do which requery, the one on the CombinedName_cbo or the one on the LastName_cbo? ...
    (microsoft.public.access.formscoding)
  • Re: Requery a Combo from Another Window
    ... If you're opening the popup as a modal form, just put the requery in the ... it won't work until the popup is closed. ... NotInList event that opens a form so user can enter a new record. ... pop-up window. ...
    (microsoft.public.access.formscoding)