Re: Requerying ComboBox in NotInList event



The way it works for me is typing:

ComboBox.Requery

I don't use the me. part because im running the code in the form
already.

Instead of using the requery on the combo box, try requerying the
From.

CurrentForm.Requery

- GL


On Mar 5, 1:37 am, Tom van Stiphout <no.spam.tom7...@xxxxxxx> wrote:
On Tue, 4 Mar 2008 11:09:22 -0800 (PST), EManning

<manning_n...@xxxxxxxxxxx> wrote:

Your code, minus the Requery, looks correct. Perhaps you have On Error
Resume Next and you are suppressing errors?

-Tom.



I have a combobox whose rowsource is a union query.  This query
displays a person's name in "lastname, firstname" format and in
"firstname lastname" format.  The query results look like this:

    Mouse, Mickey
    Mickey Mouse

When a person is added, the querys' underlying recordset is updated in
the NotInList event.  I can't figure out how to refresh the combobox
to display the new person.  I get the standard error message that the
item is not in the list.  Here's my code:

...<in the NotInList event>...
With rst
   .AddNew
   !FirstName = strFirstName
   !MiddleInitial = strMiddleInitial
   !LastName = strLastName
   .Update
End With

    Response = acDataErrAdded

I have to refresh the query somehow so that it displays in the combo
box.  If I add the code:

    Me.ComboBox.Requery

I get the standard error message that it must be saved.

Maybe there's a better way to do this?  Thanks for any help or advice.- Hide quoted text -

- Show quoted text -

.



Relevant Pages

  • Re: Requerying ComboBox in NotInList event
    ...     Mickey Mouse ... Any attempt to requery the combobox gives me an error that the field ...
    (comp.databases.ms-access)
  • Re: requery lookup information
    ... but it doesn't requery the main information. ... I assum the rowsource of cboLU excludes inactive records? ...
    (microsoft.public.access.formscoding)
  • Re: Requery Not Working
    ...     If Me.Dirty Then ... This will only requery the form If the record was added to the table. ... Private Sub Command15_Click ... Dim frm As Form ...
    (microsoft.public.access.formscoding)
  • Re: whats the best way to backup/restore a system?
    ... which I use to backup /Users/ daily. ... a new Mac OS X installation where the first account is called say ...   open -t crontab.txt ... You can check it looks right by typing ...
    (comp.sys.mac.system)
  • Re: Casting the return value of malloc()...
    ... Casting is a way to defeat strong typing. ...    int a; ... Carroll anticipated the madness of the ... the C programmer, incompetent as a person and programmer in direct ...
    (comp.lang.c)