Choice doesn't show in combo box

L

Laurel

I have a simple form with an unbound combo box in the header and the details
bound to a table. Nothing fancy. My problem is that whenever the detail
table happens to be empty (which is OK in the real world) when the user
chooses a value from the combo box, that value doesn't display. The value
is assigned correctly, because code that references the combo box gets the
data that was chosen. The chosen value only displays if the table in the
detail part of the form has rows in it. This happens even if I comment out
the one line of code that references the combo box. In other words, it
happens even if there is no reference to the combo box in code at all. It
is not a linked control to the detail.

I've tried removing it and replacing it with and without the wizard. I've
tried putting this bit of code in the after update event...
ls_temp = cboClassCode
cboClassCode = ls_temp

Can anyone suggest other things for me to try? Has anyone seen anything
like this?
 
L

Laurel

Well, after the accelerator keys on my buttons stopped working in a random
fashion, I decided the form had problems, simple though it was. So I
recreated it from scratch, and then copied in my code. Now the problem of
displaying the chosen value in the combo box and the random breakage of
accelerator keys are both gone.

Is it inadvisable to copy controls from one form to another? It seems like
such a handy feature, but it's the only thing I can think of that might have
had potential for corrupting my form.
 
J

John Vinson

Can anyone suggest other things for me to try? Has anyone seen anything
like this?

If the Form's Recordsource is not updateable, the entire form (bound
and unbound controls) will be blank if it contains no records - is
this what's happening?

If so, consider using an unbound Form with an unbound Combo, and
display the detail data on a Subform. You can even use the combo box
itself as the Master Link Field for the combo, removing any need to
use code at all.
 
L

Laurel

Well, glory be. That was it. The one thing I had forgotten to do when I
created my brand new form was to set it to Additions = No. When I did that
the problem with the dropdown returned. (Grrr...). It seems too bad to
have to complicate my form just for this. Does anyone consider this a
bug????

AND.... this addressed the problem of the accelerator keys too. Apparently
it wasn't random at all... They worked when there were rows in the detail
and they didn't when there weren't.

Sounds a lot more like a bug than a feature to me!

Thanks for the insight!
 

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