After closing a modal form, the calling form ends up on a record that doesn't exist. Here's what happens.
I have two forms, projects and photos, which operate on separate tables in the same database. A toolbar button on Projects is used to open the photos form, and it is always opened modally.
Every time, after closing Photos, a "phantom" record seems to be created at the end of projects. Like so:
Here are the project numbers before calling photos, square brackets indicate the one displayed:
293, [294], 295, 297
Here's what it looks like after closing photos and returning to projects:
293, 294, 295, 297, [294]
EXCEPT that the last "294" isn't real. If one tries to save it, a "No current record error" is returned.
I have tried setting a bookmark, opening the photos form, and when returning from it, moving last then moving to the bookmark, but the same thing happens. Using debug.print shows that the bookmark has successfully re-positioned the record pointer on the correct record, yet the form is sitting on a phantom.
Help would be appreciated - Miles Thompson
Code is:
bkPosition = rsProjects.Bookmark
Debug.Print "Projects", rsProjects.AbsolutePosition
frmImages.Show vbModal
rsProjects.MoveLast
Debug.Print "Projects", rsProjects.AbsolutePosition
rsProjects.Bookmark = bkPosition
Debug.Print "Projects-Set to Bookmark", rsProjects.AbsolutePosition
frmProjects.Refresh
Output from the 3 debug.print's is:
Projects 22
Projects 24
Projects-Set to Bookmark 22
/mt
I have two forms, projects and photos, which operate on separate tables in the same database. A toolbar button on Projects is used to open the photos form, and it is always opened modally.
Every time, after closing Photos, a "phantom" record seems to be created at the end of projects. Like so:
Here are the project numbers before calling photos, square brackets indicate the one displayed:
293, [294], 295, 297
Here's what it looks like after closing photos and returning to projects:
293, 294, 295, 297, [294]
EXCEPT that the last "294" isn't real. If one tries to save it, a "No current record error" is returned.
I have tried setting a bookmark, opening the photos form, and when returning from it, moving last then moving to the bookmark, but the same thing happens. Using debug.print shows that the bookmark has successfully re-positioned the record pointer on the correct record, yet the form is sitting on a phantom.
Help would be appreciated - Miles Thompson
Code is:
bkPosition = rsProjects.Bookmark
Debug.Print "Projects", rsProjects.AbsolutePosition
frmImages.Show vbModal
rsProjects.MoveLast
Debug.Print "Projects", rsProjects.AbsolutePosition
rsProjects.Bookmark = bkPosition
Debug.Print "Projects-Set to Bookmark", rsProjects.AbsolutePosition
frmProjects.Refresh
Output from the 3 debug.print's is:
Projects 22
Projects 24
Projects-Set to Bookmark 22
/mt