• Requery (Win XP Access 2003)

    • This topic has 9 replies, 3 voices, and was last updated 18 years ago.
    Author
    Topic
    #441596

    Could you please show me how to do the requery on the combo box without having to click a button? What event should I use?

    Thank you.

    Viewing 1 reply thread
    Author
    Replies
    • #1060792

      The event you use depends on the circumstances that make the requery necessary.
      If you have been off somewhere else adding a record in another table, and you want to requery when you come back, use the onactivate event.

      Private Sub Form_Activate()
      Me.IdCliente.Requery
      End Sub

      • #1060805

        Using the form’s On Activate event gives me an error 2118, and hangs up on the Me.IDCliente.Requery instruction. Same with the Got Focus event on the combo box. What am I doing wrong?

        • #1060809

          I had not noticed that you were using the OnNotInList event as well. If you use that properly the combo will be requeried automatically.

          Look at the attachment. The form is openen in Dialog mode, and the new data is passed using Openargs.

          • #1060839

            Getting there. When I return to the combo box, I get event procedure message “The text you introduced is not an element in the list…………” . Can I tuirn that message off?

            • #1060840

              That message should not be there. Did you include the line:
              Response = DATA_ERRADDED
              after you open the form?

              Can you post your current version?

            • #1060843

              Here is the current version.

            • #1060880

              Using your version I don’t get any messages when I return to the combo box (unless I don’t fill in the form with customer details).

              You missed one feature of the sample I posted. The form Cliente has this code in its OnLoad event. This takes the newdata from the Combobox and puts it into the field ApellidoCliente .

              Private Sub Form_Load()
              If Not IsNull(Me.OpenArgs) Then
              Me.ApellidoCliente = Me.OpenArgs
              End If
              End Sub

            • #1060890

              The OnLoad makes the difference.

    • #1060798

      You could use the OnGotFocus event of the combo box to do the requery.

    Viewing 1 reply thread
    Reply To: Requery (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: