• Requery combo box (Win XP Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Requery combo box (Win XP Access 2003)

    Author
    Topic
    #444776

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #1076544

      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.

      • #1076545

        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?

        • #1076554

          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 for instructions.

          • #1076573

            Here is the stripped down version.

            • #1076576

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

            • #1076577

              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?

            • #1076592

              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.

    Viewing 0 reply threads
    Reply To: Requery combo box (Win XP Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: