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

    Requery (Win XP Access 2003)

    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.
    Attached Files Attached Files

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Requery (Win XP Access 2003)

    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
    Regards
    John



  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Requery (Win XP Access 2003)

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

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

    Re: Requery (Win XP Access 2003)

    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?

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Requery (Win XP Access 2003)

    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.
    Attached Files Attached Files
    Regards
    John



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

    Re: Requery (Win XP Access 2003)

    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?

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Requery (Win XP Access 2003)

    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?
    Regards
    John



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

    Re: Requery (Win XP Access 2003)

    Here is the current version.
    Attached Files Attached Files

  9. #9
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Requery (Win XP Access 2003)

    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
    Regards
    John



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

    Re: Requery (Win XP Access 2003)

    The OnLoad makes the difference.

Posting Permissions

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