vstopp
asked on
Query based on combo box: Error 2118 - You must save field before requery action
I have a subform that is based on a query which looks to the value in the combo box.
Combo Box OnChange event contains subform.requery method
The combo box on the subform from a column in the underlying record source. When I select a value in the combo box, the requery method works perfect and just displays those records which meet the criteria in the combo box.
When I clear the combo box (by deleting the data), and the requery method tries to execute (on change event), I get the following error:
'Run-time error 2118'
You must save the current field before you run the Requery Action.
If I halt out of code and the press "F9", the record source displays all the records.
Is there any workaround to this bug/problem?
Thank you for your help.
P.S. Interesting Note: I put a button on the subform to set the combo box = null and then execute the requery, and everything works fine. The problem lies wherein I delete the data from the combo box using the Delete Key, the on change event is triggered, and the subform is requeried.... That is when I get the above error.
Combo Box OnChange event contains subform.requery method
The combo box on the subform from a column in the underlying record source. When I select a value in the combo box, the requery method works perfect and just displays those records which meet the criteria in the combo box.
When I clear the combo box (by deleting the data), and the requery method tries to execute (on change event), I get the following error:
'Run-time error 2118'
You must save the current field before you run the Requery Action.
If I halt out of code and the press "F9", the record source displays all the records.
Is there any workaround to this bug/problem?
Thank you for your help.
P.S. Interesting Note: I put a button on the subform to set the combo box = null and then execute the requery, and everything works fine. The problem lies wherein I delete the data from the combo box using the Delete Key, the on change event is triggered, and the subform is requeried.... That is when I get the above error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Once again, thank you for your time in responding. I appreciate it very much. I am a solo contract programmer working with MSAccess for over 20 years, and sometimes I just get stumped and always turn to Experts Exchange for answers to my questions... Most of the time they have the most valuable answers.
;-)
ASKER
Maybe I'm a little bleary eyed from too much programming lol!
Thank you so much for your time.
Sincerely,
Val