Re: Requerying ComboBox in NotInList event



On Mar 5, 8:57 am, Guillermo_Lopez <g.lo...@xxxxxxxxx> wrote:
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 -- Hide quoted text -

- Show quoted text -

Any attempt to requery the combobox gives me an error that the field
must be saved, whether or not the "Me." is used. The form is unbound
so requerying it wouldn't do any good. Thanks for replying.
.



Relevant Pages

  • Re: Requerying ComboBox in NotInList event
    ... The way it works for me is typing: ... Your code, minus the Requery, looks correct. ...     Mickey Mouse ...  I get the standard error message that the ...
    (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: Updateing a combobox
    ... Private Sub Combo0_NotInList ... Macro object name: Macro1 ... > the combobox must be something within the list or empty. ... > because the field cannot requery while text is present. ...
    (microsoft.public.access.formscoding)
  • Re: [VFP7] Grid mit abhaengigem Combofeld
    ... Stehen in der ComboBox nicht die richtigen ... REQUERY(). ... Prev by Date: ... Next by Date: ...
    (microsoft.public.de.fox)