Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Old and new values of combo box columns.

Geek News

Old and new values of combo box columns.
Proko 12/14/2008 10:43:01 PM
I use the before update event to find the old and new values of the bound
column of my combo box with:
cbo_mycombo.OldValue and cbo_mycombo.Value

But, is it posible to find the old and new values of an unbound column in
the combo box with something like cbo_mycombo.Column(2).Value.

Any help would be greatly appreciated.
Re: Old and new values of combo box columns.
"Stuart McCall" <smccall[ at ]myunrealbox.com> 12/14/2008 11:02:16 PM
"Proko" <Proko[ at ]discussions.microsoft.com> wrote in message
news:5F0A1915-275F-406A-A48C-3E61A2C4324C[ at ]microsoft.com...
[Quoted Text]
>I use the before update event to find the old and new values of the bound
> column of my combo box with:
> cbo_mycombo.OldValue and cbo_mycombo.Value
>
> But, is it posible to find the old and new values of an unbound column in
> the combo box with something like cbo_mycombo.Column(2).Value.
>
> Any help would be greatly appreciated.

There's no built-in method, but you can easily roll your own. Create a
module-level variable to hold the old value. Call it (say) m_OldValue. Then
in your combo's GotFocus event, store the current value:

m_OldValue = Me.ComboName.Column(2).Value

Then, in the combo's BeforeUpdate event, use the variable to compare against
the current value:

If Me.ComboName.Column(2).Value <> mOldValue Then
MsgBox "They don't match!"
End If

Just curious: why do you want to do this?


Re: Old and new values of combo box columns.
Proko 12/15/2008 5:18:00 AM
Worked a treat! Thanks Stuart.
For the benefit of others, your line:
m_OldValue = Me.ComboName.Column(2).Value
should read
m_OldValue = Me.ComboName.Column(2)

The '.value' should be omitted.

"Stuart McCall" wrote:

[Quoted Text]
> "Proko" <Proko[ at ]discussions.microsoft.com> wrote in message
> news:5F0A1915-275F-406A-A48C-3E61A2C4324C[ at ]microsoft.com...
> >I use the before update event to find the old and new values of the bound
> > column of my combo box with:
> > cbo_mycombo.OldValue and cbo_mycombo.Value
> >
> > But, is it posible to find the old and new values of an unbound column in
> > the combo box with something like cbo_mycombo.Column(2).Value.
> >
> > Any help would be greatly appreciated.
>
> There's no built-in method, but you can easily roll your own. Create a
> module-level variable to hold the old value. Call it (say) m_OldValue. Then
> in your combo's GotFocus event, store the current value:
>
> m_OldValue = Me.ComboName.Column(2).Value
>
> Then, in the combo's BeforeUpdate event, use the variable to compare against
> the current value:
>
> If Me.ComboName.Column(2).Value <> mOldValue Then
> MsgBox "They don't match!"
> End If
>
> Just curious: why do you want to do this?
>
>
>
Re: Old and new values of combo box columns.
"Stuart McCall" <smccall[ at ]myunrealbox.com> 12/15/2008 6:23:29 AM
"Proko" <Proko[ at ]discussions.microsoft.com> wrote in message
news:8BA89F01-6E2F-443D-BFFE-4FEB6A7F74A2[ at ]microsoft.com...
[Quoted Text]
> Worked a treat! Thanks Stuart.
> For the benefit of others, your line:
> m_OldValue = Me.ComboName.Column(2).Value
> should read
> m_OldValue = Me.ComboName.Column(2)
>
> The '.value' should be omitted.

<Homer's voice> Doh!


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net