Deleting a record and returning to first record (1 Viewer)

tlc1974

Registered User.
Local time
Today, 19:08
Joined
Aug 4, 2003
Messages
21
I have a form containing hundreds of records and if I delete record number 50 I don't want to return to the first record on the form. Does anyone know how I can force the form to stay not go to the first record.

Thanks in advance.
 

dan-cat

Registered User.
Local time
Today, 19:08
Joined
Jun 2, 2002
Messages
3,433
do you mean the first field on your form? :confused:
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:08
Joined
Feb 19, 2002
Messages
43,781
You must be requerying the form. That will make the record pointer move back to the first record. You should not need to requery after you delete.
 

tlc1974

Registered User.
Local time
Today, 19:08
Joined
Aug 4, 2003
Messages
21
Requery

I need to requery as the form has number of records displayed etc.
 

Mile-O

Back once again...
Local time
Today, 19:08
Joined
Dec 10, 2002
Messages
11,316
Re: Requery

tlc1974 said:
I need to requery as the form has number of records displayed etc.

Where? On/In a "home-made" control?
 

tlc1974

Registered User.
Local time
Today, 19:08
Joined
Aug 4, 2003
Messages
21
The form has a field which on current of the form counts the number of records and displays this instead of using the access form counter and navigation.
 

Mile-O

Back once again...
Local time
Today, 19:08
Joined
Dec 10, 2002
Messages
11,316
In the event procedure whereby you delete the record you add this line before the End Sub.

Code:
Call Form_Current
 

tlc1974

Registered User.
Local time
Today, 19:08
Joined
Aug 4, 2003
Messages
21
Thanks for that - I have just tried that and as I have my own delete button with code behind it I can get the form to delete the record and stay on the same record but the recordcount field I have doesn't update and when I move through the records I eventually come to one that has all fileds displaying deleted, because it hasn't been refreshed/requeried. If I do refresh/requery though it will return me to the first record on the form.
 

Users who are viewing this thread

Top Bottom