By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,375 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Why is combo showing wrong value ?

Expert 100+
P: 446
Hi all
I have a situation where I have an existing form that has funcioned well for years but is giving a problem running in Access 2010. There are two combo boxes in the header of a form, which set a filter criteria for displaying a stock listing.

The combos 'cascade' such that the AfterUpdate event of combo1 sets a parameter and then a Requery of combo2.

The AfterUpdate of combo2 sets the string for filtering the form and then calls Me.FilterOn = True. The data in the Detail section of the form is always correct (i.e. the filtering works ok) but the value displayed in combo2 can be wrong.

If the form has just been opened then combo2 becomes blank after making a selection. If subsequent selections are made in combo2 it displays the correrct data.

However, if combo1 is reselected (changed) and a new selection made from combo2, again the data is filtered correctly but the value displayed in combo2 is the previous value. It is only correct after making subsequent selections without changing combo1.

The query returns four columns; the first is bound and the other three are zero width. The data is 'Limit to List' and yet the 'wrong' values are not in the list.

I've followed my code in debug mode and fairly certain the process is as described above.

Has anyone a clue to what is happening ?

S7
Jul 8 '10 #1

✓ answered by sierra7

@nico5038
Problem solved!

It seems that the 'Me.FilterOn = True' statement is causing an On_Got_Focus event to fire for the form in Access 2010 but not in 2003.

I'm pretty certain about this because I have re-tested in both situations and inserted a MessageBox to announce 'Got Focus'.

I had some 'residual' code in my original form which was trying to do things like 'DoCmd.Maximize' and 'Me.Requery'. This was having no effect in 2003 but was causing my combo to roll back to a previous value in 2010. (At least I think that's what was going on!)

I remember that when this system was being developed I had trouble resizing when moving between forms, and attempted to use 'Got Focus' and 'Activate' to trigger a re-size, with mixed results. I guess this code is a hang-over from then.

It seems 2010 is a bit more rigorous that 2003 so it will be interesting what else reveals itself.

Thanks for your help Nic;o) . Let me know if you still want the database to test this yourself and I'll try and work out how to attach it.

Thanks
S7

Share this Question
Share on Google+
4 Replies


nico5038
Expert 2.5K+
P: 3,072
Can you attach a sample database with this erroneous behavior, then I'll have a look tomorrow.

Nic;o)
Jul 9 '10 #2

Expert 100+
P: 446
@nico5038
Yes, I was persuading myself to do this as my next step anyway. It's my first task this morning.
Jul 9 '10 #3

Expert 100+
P: 446
@nico5038
Problem solved!

It seems that the 'Me.FilterOn = True' statement is causing an On_Got_Focus event to fire for the form in Access 2010 but not in 2003.

I'm pretty certain about this because I have re-tested in both situations and inserted a MessageBox to announce 'Got Focus'.

I had some 'residual' code in my original form which was trying to do things like 'DoCmd.Maximize' and 'Me.Requery'. This was having no effect in 2003 but was causing my combo to roll back to a previous value in 2010. (At least I think that's what was going on!)

I remember that when this system was being developed I had trouble resizing when moving between forms, and attempted to use 'Got Focus' and 'Activate' to trigger a re-size, with mixed results. I guess this code is a hang-over from then.

It seems 2010 is a bit more rigorous that 2003 so it will be interesting what else reveals itself.

Thanks for your help Nic;o) . Let me know if you still want the database to test this yourself and I'll try and work out how to attach it.

Thanks
S7
Jul 9 '10 #4

nico5038
Expert 2.5K+
P: 3,072
It's sufficient to know that it's the event sequence causing the trouble. Have been running into a similar problem with an A2003 mdb that was upgraded to A2007.

Success !

Nic;o)
Jul 9 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.