Requery Current Record Killing Me

W

wasseem

I am utilizing a subform that has two fields State and ClassCode which the
users can keep adding new states and classcodes (continuous forms). Currently
I have it set up for the user to choose the state and on the AfterUpdate it
requery the ClassCode to make sure it only shows ClassCodes for a particular
state and program. It works perfectly as long as I choose the same state;
however, when I choose if I choose a different state for the next entry the
class code field with a different state clears. it appears the data is still
correct it just disappears from the form. I can choose say GA 3 times and see
all the class codes fine but if the fourth time I choose FL all the GA class
codes disappear. I probably also need to note that these states and class
codes are associated with one employer.
 
J

John Vinson

I am utilizing a subform that has two fields State and ClassCode which the
users can keep adding new states and classcodes (continuous forms). Currently
I have it set up for the user to choose the state and on the AfterUpdate it
requery the ClassCode to make sure it only shows ClassCodes for a particular
state and program. It works perfectly as long as I choose the same state;
however, when I choose if I choose a different state for the next entry the
class code field with a different state clears. it appears the data is still
correct it just disappears from the form. I can choose say GA 3 times and see
all the class codes fine but if the fourth time I choose FL all the GA class
codes disappear. I probably also need to note that these states and class
codes are associated with one employer.

What you can do to get around this annoying side effect is to add a
Textbox to the continuous subform. Carefully superimpose it over the
text area (don't conceal the dropdown arrow!) of the combo box. It
should have a Control Source displaying the Class (either by including
the ClassCodes table in your Query, or using DLookUp if the value to
be displayed isn't in the form's recordsource); set the textbox to
Enabled = No, Locked = Yes, Tab Stop = No so the user can't select it
or do anything with the displayed data.

When you drop down the combo box, its list will pop in front of the
textbox; otherwise the textbox will display the proper code.

John W. Vinson[MVP]
 
W

wasseem

thanks a lot
it works

John Vinson said:
What you can do to get around this annoying side effect is to add a
Textbox to the continuous subform. Carefully superimpose it over the
text area (don't conceal the dropdown arrow!) of the combo box. It
should have a Control Source displaying the Class (either by including
the ClassCodes table in your Query, or using DLookUp if the value to
be displayed isn't in the form's recordsource); set the textbox to
Enabled = No, Locked = Yes, Tab Stop = No so the user can't select it
or do anything with the displayed data.

When you drop down the combo box, its list will pop in front of the
textbox; otherwise the textbox will display the proper code.

John W. Vinson[MVP]
 
M

MacDermott

That's how comboboxes work in Access -
if the value in the field doesn't match one of the items in the
drop-down, it isn't displayed. When you change from GA to FL, you change
the items in the drop-down by requerying it.
 
Top