开发者

Access VBA Form current record is deleted

开发者 https://www.devze.com 2023-04-12 21:41 出处:网络
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 delet

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.

If the user deleted the currently viewed row, the fields on the form show #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?

Where have I gone wrong?


It would be better to put the requery in the dialog:

Forms!FormA.Requery
0

精彩评论

暂无评论...
验证码 换一张
取 消