locked
combobox not changing record RRS feed

  • Question

  • converted an Access2000 file to Access2007.accdb

    a form (Single) did not have a combo box in its header - and so this was added - and works fine - so far so good

    set up a new feature so user could duplicate a record - to ease creation of a new record without having to enter all new data into fields.  this also works so far so good - and a button for it exists on the form now

    the button code runs the append query, and also forces the combobox in the header to requery - and so the new record is seen in the combobox (the sort puts it at top) - so far so good

    the problem is when one selects this new record in the combobox - the form record does not change to it - -

    I'm a little baffled by this.  One can change to another record fine....but this new record will not work - - no matter what....if the form is closed and reopened then this new record can be selected fine.....

    TIA

    Friday, December 14, 2012 6:03 PM

Answers

  • converted an Access2000 file to Access2007.accdb

    a form (Single) did not have a combo box in its header - and so this was added - and works fine - so far so good

    set up a new feature so user could duplicate a record - to ease creation of a new record without having to enter all new data into fields.  this also works so far so good - and a button for it exists on the form now

    the button code runs the append query, and also forces the combobox in the header to requery - and so the new record is seen in the combobox (the sort puts it at top) - so far so good

    the problem is when one selects this new record in the combobox - the form record does not change to it - -

    I'm a little baffled by this.  One can change to another record fine....but this new record will not work - - no matter what....if the form is closed and reopened then this new record can be selected fine.....

    If the button code runs an append query, so that the record is effectively added from outside the form, then the record isn't in the form's recordset.  You'll have to requery the form after adding the record, using a statement like this:

        Me.Requery

    Note, though, that doing that will cause the form to reposition itself to the first record in its (requeried) recordset.  If you need the form to return automatically to the record that it was on, you can write code to do that;  or if you need the form to go to the record that was added, you can write code to do that.  The exact code will depend both on how you want the form to behave and on what code you are using to add the record.


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Friday, December 14, 2012 7:38 PM

All replies

  • converted an Access2000 file to Access2007.accdb

    a form (Single) did not have a combo box in its header - and so this was added - and works fine - so far so good

    set up a new feature so user could duplicate a record - to ease creation of a new record without having to enter all new data into fields.  this also works so far so good - and a button for it exists on the form now

    the button code runs the append query, and also forces the combobox in the header to requery - and so the new record is seen in the combobox (the sort puts it at top) - so far so good

    the problem is when one selects this new record in the combobox - the form record does not change to it - -

    I'm a little baffled by this.  One can change to another record fine....but this new record will not work - - no matter what....if the form is closed and reopened then this new record can be selected fine.....

    If the button code runs an append query, so that the record is effectively added from outside the form, then the record isn't in the form's recordset.  You'll have to requery the form after adding the record, using a statement like this:

        Me.Requery

    Note, though, that doing that will cause the form to reposition itself to the first record in its (requeried) recordset.  If you need the form to return automatically to the record that it was on, you can write code to do that;  or if you need the form to go to the record that was added, you can write code to do that.  The exact code will depend both on how you want the form to behave and on what code you are using to add the record.


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Friday, December 14, 2012 7:38 PM
  • ah that does make sense of course.

    thank you

    Friday, December 14, 2012 7:49 PM