Access VBA Form current record is deleted
I'm using Access 2003.
I have a form (FormA) that displays the fields of a row in TableA. On the form I have a button that opens a dialog with a listbox that lists all of the rows of TableA. A delete button on the dialog form allows the user to delete a selected row from the TableA, T开发者_JAVA技巧he user then closes the window and is returned to FormA.
#DELETED.
I coded a Me.Form.Requery upon returning from the dialog. When it executes I get a runtime error that the record is deleted. Instead of the error, I expected the form to requery and reposition the current record.
I have code in Sub Form_Current(). Just to see if that was affecting the requery process I commented it out. Now the form is requeried as expected.
It seems that existence of Form_Current() prevents the requery. I tried coding a Me.Requery in Form_Current and all I did was loop.
The code I have in Form_Current() requeues subforms. So it's a requirement that the form gets requeued before requesting a requeue of the subforms.
Is there a way to requeue the before Form_Current() gets called? Is there a better approach?
It would be better to put the requery in the dialog:
Forms!FormA.Requery
加载中,请稍侯......
精彩评论