Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Unanswered: Change combobox value

    Might be a tad newbish;

    i tried changing the value of the combobox through code but it doesn't seem to let me do this...

    when i add this code to the BeforeUpdate section of the combo box,

    Me.StatusTypeID.Value = 2

    it just rejects it and gives me an error saying that it cant make the change.
    However, if i do the same thing to a command1_click , it lets me do it.

    thx!

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Jerrie
    Might be a tad newbish;

    i tried changing the value of the combobox through code but it doesn't seem to let me do this...

    when i add this code to the BeforeUpdate section of the combo box,

    Me.StatusTypeID.Value = 2

    it just rejects it and gives me an error saying that it cant make the change.
    However, if i do the same thing to a command1_click , it lets me do it.

    thx!
    You can't on a Before_Update event ... As for changing the value thru code...

    MyCombobox.Value= Some value here

    -or-

    MyCombobox.Column(XXX,YYY) = Some value here

  3. #3
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    lol thx...yea i had a hunch it was the before_update...will try on the on_change or after_update..

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Jerrie
    lol thx...yea i had a hunch it was the before_update...will try on the on_change or after_update..
    Why bother?

  5. #5
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    here's the impetus behind this whole thing;

    if the user selects a specific value from that list, i want it to prompt them with "Do you really want to change this, vbYesNo" ..and if yes, it sticks the change...if no, it reverts to previous state;

    however, to do the previous state, i need to change the value during the on_change or on_afterUpdate

    any quicker, less painful solutions?

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Jerrie
    here's the impetus behind this whole thing;

    if the user selects a specific value from that list, i want it to prompt them with "Do you really want to change this, vbYesNo" ..and if yes, it sticks the change...if no, it reverts to previous state;

    however, to do the previous state, i need to change the value during the on_change or on_afterUpdate

    any quicker, less painful solutions?
    Ahhhhh .... That's a whole nother kettle of fish. You need to do your prompt in the Before_Update event then BUT, if they cancel (or say no) merely set the Canel flag to something non-zero ... Also you might wish to capture the original value to restore ... You do this in the After_Update because the original value will not be restored otherwise ... Just set the vule to what you had before ...

  7. #7
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    yea i stored the prev state in a public var...that gets it value changed whenever on_click...or maybe on_change

    but i didn't know bout that part changing cancel to non-zero;
    thx!

Posting Permissions

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