Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Requery combo box (Win XP Access 2003)

    I have a combo box which looks up a customer ID for me to set the form frmClienteNvo to the corresponding customer. To add a new customer to my combo box, I use a command button to open a form where I add the new customer. After I close the form with the new customer added, using the combo box’s OnGotFocus event, I run a macro which requeries the combo box.

    In the frmClienteNvo OnCurrent event, I have a statement which sets the combo box equal to the customer ID from the form so as to synchronize the combo box when I change the customer from somewhere else and not from the combo box.

    The new customer shows up correctly in the combo box but, when I try to move to the new customer in the combo box, the accompanying form does not synchronize, and the new customer is not available

    Any ideas of how to get the form back in synch?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery combo box (Win XP Access 2003)

    Since you are adding a record to the record source of frmClienteNuevo, you also need to requery this form, otherwise it doesn't "know" that there is a new record.

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery combo box (Win XP Access 2003)

    I added the statement Me.Requery to the OnCurrent event after the Me.ComboBox.Requery statement, but the program goes into a loop and dies with an Out Of Stack Space error. I tried a macro with Requery and frmClienteNvo as the argument, followed by Requery with no arguments which is supposed to requery the form, I think. That didn't work, but it didn't hang up, either.

    Is Me.requery correct?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery combo box (Win XP Access 2003)

    Me.Requery is correct.

    I think we'll need to see the database. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery combo box (Win XP Access 2003)

    Here is the stripped down version.
    Attached Files Attached Files

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery combo box (Win XP Access 2003)

    In the on Click event of Button Comando55 add the line :
    Me.Requery
    Attached Files Attached Files
    Francois

  7. #7
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requery combo box (Win XP Access 2003)

    That works fine. It is somewhat counter-intuitive to use that botton, but I am changing it's title, which will help. I think it will be a good solution, and I thank you all.

    Does anyone have any idea of why the on-current event didn't work?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requery combo box (Win XP Access 2003)

    Trying to requery the form (i.e. re-open the query qryClientesFrm) while the form is moving to another record confuses Access.
    Adding it to the On Click event of the command button lets Access requery the form before moving to another record.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •