Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making a combobox up to date (ms access 2007)

    On my form "frmOrders" i have a button with the following click event:

    Private Sub CmdZoekOrder_Click()

    On Error GoTo ErrorHandler
    Me!cboOrdernr.Requery
    Me!cboOrdernr.Visible = True
    Me!cboOrdernr.SetFocus
    Me!cboOrdernr.Dropdown

    Afsluiten:
    On Error GoTo 0
    Exit Sub

    ErrorHandler:

    Call HandleError(Err.Number, Err.Description, "CmdZoekOrder_Click", "frmOrders")
    Resume Afsluiten

    End Sub

    This event makes a combobox visible and let it display the items of his rowsource which are the ordernumbers of all saved orders. That makes it possible to choose the ordernr of a order i want to display.
    When such an order is choosen and deleted and after that i use this button again to go to another order, the deleted order is still there but marked as " deleted".
    It seems that the rowsource of the combobox isn't updated after the deletion of the order.
    However, in the click event hereabove there is a statement me!cboOrder.requery. But that doesn't seems to work.
    I also tried me!cboOrder.rowsource.requery, but that generated an error.
    What to do, to have the rowsource of the combobox be updated immediatly?

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

    Re: making a combobox up to date (ms access 2007)

    Try adding a line

    Me!cboOrdernr.Requery

    to the AfterDelConfirm event of the form.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a combobox up to date (ms access 2007)

    Dear Hans;

    Thank you !!!

  4. #4
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a combobox up to date (ms access 2007)

    Dear Hans;

    I just did what you advised, but the result remains the same, the deleted item is still displayed as deleted.
    I do not know if this is of any importance,but i must say that after deleting the order, i do not reopen the form, but make the choice for another order immediatly

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

    Re: making a combobox up to date (ms access 2007)

    I tested it and requerying the combo box in the After Del Confirm event of the form removed the deleted item from the list as intended.

    Could you post a stripped down copy of your database (.mdb format, not .accdb)? See <post#=401925>post 401925</post#> for instructions.

Posting Permissions

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