Old and new values of combo box columns.

P

Proko

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.
 
S

Stuart McCall

Proko said:
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?
 
P

Proko

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.
 
S

Stuart McCall

Proko said:
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top