Control retains previous value

B

Bob Paup

How do I make a combo box retain the previous value such that in continous
entry if a value does not change the data enterer can just tab the the next
control?
 
B

Brian Bastl

In the AfterUpdate procedure of your combo:

Me.YourCombo.DefaultValue = Me.YourCombo

Is that what you're after?

Brian
 
B

Bob Paup

When I insert that code I get #Name? in the combo box when I try to enter a
new record instead of the last value. I had a similar problem when I set up
the same code for an option group. There I had to put this code in the on
current event as well. When I do this for the combo box I get an error which
says:
Run-time error '2447': There is an invalid use of the . (dot) or ! operator
or and invalid parentheses.
This is the code that the debugger points to:
Me.Combo103.DefaultValue = Me.Combo103
Bob
 
B

Brian Bastl

Funny, works for me everytime. Perhaps try:

Me!Combo103.DefaultValue = Me!Combo103

Brian
 
B

Bob Paup

I tried your suggestion. It didn't make any difference. Something is
missing as signified by the invalid use of the . (dot) or ! .
Is it because I am getting the values to put in the box from a table that is
different than the table they are going into. This seems right, but maybe
this makes a difference.
Bob
 
B

Bob Paup

I changed to a list box and at least it retains the value. Another problem
appeared which is the subject of a new post.
Bob
 

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