Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 2118, Must Save Current Field B4 you run Requery

Status
Not open for further replies.

justagrunt

Technical User
Joined
Oct 10, 2002
Messages
132
Hi,
This problem has recently raised it head, where by what once worked now produces the runtime error. I have an unbound combo box, on a main form, which on not inlist, calls a separate form where information can be added. On save or close this form calls up the Combo and askes it to be requeried, so the user could select the new information. Simple it worked for untill the server was upgraded to Win2000, so not sure if this is the starting point.
Code is as follows.

Private Sub Form_Close()

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'Record is saved. Requery Combo72 in Add Sales Register to update its list.
[Forms]![Sales Enquiry Register]![Combo72].Requery

End Sub

any suggestion welcomed, other alternatives please.
Kind Regards.
 
Yeah, if somebody figures out how to do this I'd like to know, too. I finally changed my combobox to LimitToList="No" and wrote my own code to put in the BeforeUpdate sub that saves the field, then checks it against the table. If the entry is not in the table, it opens a new form to enter it then requeries the combobox when the first form gets focus again. Works for me; I spent beaucoup time trying to figure aout a workaround using LimitToList = "Yes".

The Missinglinq "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
If Anyones Interested I may have resolved the problem.
In the Combo boxes On NotInlist, just after the Instruction to open the other form i have entered the following.

Response=acDataErrAdded
Me!Combo.Undo

This seems to undo the text in the field and set it to null so the Run time error doesn't occur.

The other form can then requery the Combo box with out worry.
Found the tip whilst surfing so take no credit for it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top