PC Review


Reply
Thread Tools Rate Thread

Updating values in combo boxes

 
 
=?Utf-8?B?RGF2aWQgQ2xlYXZl?=
Guest
Posts: n/a
 
      7th Sep 2005
Hi all

I’m having a serious problem with a combo box. I need it to tell me whenever
its value is changed. At the moment, I am testing its current value against
its .OldValue property. Problem is, the .OldValue property refers to the
value it held when the form was loaded, which gets out of date if the value
of the combo box is changed more than once.

Please tell me how I can either:
- force an update of the value of the combo box so that .OldValue property
contains the last value the combo box held
- access the last-held value of the combo box, if the .OldValue property
cannot be updated

Many thanks

David
 
Reply With Quote
 
 
 
 
Al Camp
Guest
Posts: n/a
 
      7th Sep 2005
David,
Not quite sure what you're doing here, but...
Use the OnCurrent event of the form to set a hidden text control or a
variable (ex. OldValue) to the combo value at OnCurrent time.
Use the BeforeUpdate event to "catch" changes, as compared to the
OldValue value. (perhaps warn the user?)
Use the AfterUpdate event to store a "new" OldValue if you allowed the
changes.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"David Cleave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all
>
> I'm having a serious problem with a combo box. I need it to tell me
> whenever
> its value is changed. At the moment, I am testing its current value
> against
> its .OldValue property. Problem is, the .OldValue property refers to the
> value it held when the form was loaded, which gets out of date if the
> value
> of the combo box is changed more than once.
>
> Please tell me how I can either:
> - force an update of the value of the combo box so that .OldValue property
> contains the last value the combo box held
> - access the last-held value of the combo box, if the .OldValue property
> cannot be updated
>
> Many thanks
>
> David



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGF2aWQgQ2xlYXZl?=
Guest
Posts: n/a
 
      7th Sep 2005
Good thinking!

Thanks Al!

"Al Camp" wrote:

> David,
> Not quite sure what you're doing here, but...
> Use the OnCurrent event of the form to set a hidden text control or a
> variable (ex. OldValue) to the combo value at OnCurrent time.
> Use the BeforeUpdate event to "catch" changes, as compared to the
> OldValue value. (perhaps warn the user?)
> Use the AfterUpdate event to store a "new" OldValue if you allowed the
> changes.
> --
> hth
> Al Camp
> Candia Computer Consulting - Candia NH
> http://home.comcast.net/~cccsolutions
>
>
> "David Cleave" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi all
> >
> > I'm having a serious problem with a combo box. I need it to tell me
> > whenever
> > its value is changed. At the moment, I am testing its current value
> > against
> > its .OldValue property. Problem is, the .OldValue property refers to the
> > value it held when the form was loaded, which gets out of date if the
> > value
> > of the combo box is changed more than once.
> >
> > Please tell me how I can either:
> > - force an update of the value of the combo box so that .OldValue property
> > contains the last value the combo box held
> > - access the last-held value of the combo box, if the .OldValue property
> > cannot be updated
> >
> > Many thanks
> >
> > David

>
>
>

 
Reply With Quote
 
Daniel Doyle
Guest
Posts: n/a
 
      7th Sep 2005
You could store the previous value in a form level variable and populate
this on the form's Current event and also the controls Enter event, although
Null may cause a problem.
Why do you need to capture the control's previous value - maybe there is a
better way to solve your problem?

Dan.

Option Compare Database
Option Explicit

Dim LastValue As String

Private Sub Form_Current()
LastValue = Me.Text0
End Sub

Private Sub Text0_Enter()
LastValue = Me.Text0
End Sub

"David Cleave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all
>
> I'm having a serious problem with a combo box. I need it to tell me

whenever
> its value is changed. At the moment, I am testing its current value

against
> its .OldValue property. Problem is, the .OldValue property refers to the
> value it held when the form was loaded, which gets out of date if the

value
> of the combo box is changed more than once.
>
> Please tell me how I can either:
> - force an update of the value of the combo box so that .OldValue property
> contains the last value the combo box held
> - access the last-held value of the combo box, if the .OldValue property
> cannot be updated
>
> Many thanks
>
> David



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate combo boxes from results of other combo boxes matt.pimm@gmail.com Microsoft Access Forms 1 13th Jan 2006 03:47 PM
Make combo boxes change contents depending on other combo boxes =?Utf-8?B?R2x5bm4=?= Microsoft Access Forms 1 9th Dec 2005 02:32 PM
Help with basing Combo Boxes on other Combo Boxes =?Utf-8?B?V2FsdA==?= Microsoft Access Forms 1 26th May 2005 03:01 AM
Re: Combo boxes dependent on combo boxes Van T. Dinh Microsoft Access 0 21st Jul 2003 02:22 PM
Re: Combo boxes dependent on combo boxes Kevin @ 3NF Microsoft Access 0 21st Jul 2003 01:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:39 AM.