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

Unable to Execute Requery Action

100+
P: 124
I have a pop up form bound to a table. When I close the pop up form, I want to requery another form because it aggregates data related to my pop up form. So, on the OnClose event of my pop up form I have:

Forms!f_Main!sfrmDegReq.Requery

However, when I close the form I get the following error:

Run-time error 2118: You must save the current field before you run the requery action.

I have no idea which field it is referring to. The record is saved in the table. And this doesn't happen everytime. I suppose I could absorb the error in my error handling but I would prefer to try to find out what the problem is and resolve it if possible.
May 14 '10 #1
Share this Question
Share on Google+
3 Replies


missinglinq
Expert 2.5K+
P: 3,532
Is the popup being form called from the form you're trying to requery? If so, you may need to save the current record on that form before calling the popup,
using something like

If Me.Dirty Then Me.Dirty = False

Linq ;0)>
May 14 '10 #2

100+
P: 124
@missinglinq
Yes, the popup is being called from the form I'm trying to requery. However, after selecting a value in my last required combobox I have the following in the combobox's AfterUpdate event:

DoCmd.RunCommand acCmdSaveRecord

Should I replace this with the code you provided? Also, I'm not getting the error now so I'm going to have to wait until I get it again.
May 14 '10 #3

missinglinq
Expert 2.5K+
P: 3,532
Either will do the job, but the error message would indicate that the popup is sometimes being called before a selection is being made from the last required combobox or after the selection is made and after data in another control is added or changed, hence making the form Dirty again.

I'd place either code immediately before the line to open the popup form.

Linq ;0)>
May 14 '10 #4

Post your reply

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