Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Mar 2001
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AfterUpdate doesn't work (Access 2000 SR1)

    I have a form with 5 combo boxes and 1 list box. I have recently added the 5th combo and made all the SQL/properties much like the other 4 combos. Unfortunately the afterupdate event of this new combo does not seem to want to fire event though I change the data the combo is displaying.
    I wonder if anybody else has come across this kind of behaviour and what you solution was?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    Sorry, but I've never seen anything like that. Is there some relationship between the comboboxes? That is, does one combobox requery another or reference another, etc.? Under what circumstances does the AfterUpdate event not fire? And do you have any code in the AfterUpdate event for that combobox and is the AfterUpdate property set to "[Event Procedure]"?
    Charlotte

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

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    Another thought. Do you realise that "after update" events are not triggered when the value is changed by code, only when the user changes the value?
    Regards
    John



  4. #4
    New Lounger
    Join Date
    Mar 2001
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    Hi Charlotte - thanks for replying so quickly!

    All the combos on the form relate to each other as I'm changing the other combos Rowsource properties depending on what's chosen from a single combo, and the values of each combo are used as query criteria for a rowsource of a list box, also on the same form.

    The AfterUpdate event of the 1st 4 combo boxes fires every time without fail, however on this new combo (the 5th one) if I delete the procedure in the IDE, save and paste it back again the event works. Then if I close the form/db and reopen it at a later stage, the AfterUpdate event does not fire for that combo only (very strange, hence my original question to this forum!)

    Yes I do have code in the AfterUpdate event of the 5th combo - it's the same as that for all the other combos, a separate procedure that mainly alters the Rowsource properties of the other combos and list box on the form. I've breakpointed the AfterUpdate event procedure and, (in desperation) placed a Msgbox statement in the event procedure to check its operation, all without success so far.

    I've had a quick look through Microsoft knowledgebase, again without success so far

    Any thoughts/suggestions would be much appreciated as I'm about to throw this form out of my (real!) window!!!!!

    Thanks in advance

    Nigel

  5. #5
    New Lounger
    Join Date
    Mar 2001
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    Hi John

    Thanks for your suggestion - the behaviour I think is incorrect occurs when the user selects a new value form the combo box and the code that I have attached to the AfterUpdate event procedure does not fire. I'm definitely not changing the value of the combo in code, merely using it to drive changes to the RowSource of other combos/list box on the same form

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    You never explained what doesn't happen with the 5th control. Are you saying that if you set a breakpoint in the declaration line of the AfterUpdate event of that control, it never fires? Even with its AfterUpdate property set to [event procedure]?

    If you are positive that the 5th combobox is properly connected to its AfterUpdate event, you may have a corrupted form. There are a couple of things you could try. You could rebuild the entire form from scratch, and if it isn't too complex, that might be your best bet.

    Another option is to create a new database and import all the objects from the old one. If the form is corrupted it may not import, and you will know what the problem is.

    You could also export the form's code module to a text file. It won't actually offer you that format as a choice, but simply replace the suggested extension with txt, and the file will save with that extension. Bas and cls files are just text files anyhow. Then create a new form and copy only the controls from the current form, no code. Save the form and go into the VBE by selecting the code icon from the Form Design menubar. Select all the code in the module, including the option statements at the top and delete them. Then use the File option from the Insert menu to insert the module you saved as a text file into your form's code module. Make sure all you controls are connected to their routines because this doesn't always happen automatically. Then save and close the form If that doesn't do it, create a new form and create new controls on it. Then you can try importing the text file into that form's module to see what happens.
    Charlotte

  7. #7
    New Lounger
    Join Date
    Mar 2001
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate doesn't work (Access 2000 SR1)

    Hi Charlotte

    Thanks for your suggestions yet again, but on closer examination I discovered that the combo control was not connected to the code via the [Event Procedure] statement in the AfterUpdate property of the combo <img src=/S/doh.gif border=0 alt=doh width=15 height=15>

    Looks like it's working properly now - thanks once again for pointing me in the right direction

    Kind regards

    Nigel

Posting Permissions

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