How to bypass "No current record" error

How to bypass "No current record" error

am 04.02.2005 00:18:19 von hebandgene

When I delete a record in a subform I get the warning that I'm about to
delete a record, followed by an error "No current record." When I
click OK obviously the record is deleted and it goes to the first
record (as I've coded it to do) or it shows me a blank record if the
deleted record was the only one.

So, what I'd like to do is bypass that 'No current record' altogether
to avoid user confusion. Is there any way to code it out without
ignoring my error handling?

Thanks!!

Re: How to bypass "No current record" error

am 04.02.2005 04:23:35 von Allen Browne

If is occurs in Access 2002 Service Pack 3, then it is a known bug.

Temporarily comment out any error handler handler so your code pauses at the
error. Note the error number. In the error handler part of your code, just
ignore that error, i.e. insert:
If Err.Number <> xxxx Then

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"hebandgene" wrote in message
news:1107472699.275599.214400@c13g2000cwb.googlegroups.com.. .
> When I delete a record in a subform I get the warning that I'm about to
> delete a record, followed by an error "No current record." When I
> click OK obviously the record is deleted and it goes to the first
> record (as I've coded it to do) or it shows me a blank record if the
> deleted record was the only one.
>
> So, what I'd like to do is bypass that 'No current record' altogether
> to avoid user confusion. Is there any way to code it out without
> ignoring my error handling?

Re: How to bypass "No current record" error

am 04.02.2005 16:07:28 von hebandgene

Allen, THANK YOU! That is exactly what I needed. However, my error
didn't have a number so I used...

If Err.Description = "No current record" Then Resume
Exit_cmdDeleteWall_Click

Doin' the Access Happy Dance...
Heather

Re: How to bypass "No current record" error

am 04.02.2005 19:19:28 von Allen Browne

It does have a number, given by Err.Number.

I believe this one is 3021.

(Better to use the numbers, in case MS changes the messages, or your db is
used in a different language.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"hebandgene" wrote in message
news:1107529648.646679.245970@z14g2000cwz.googlegroups.com.. .
> Allen, THANK YOU! That is exactly what I needed. However, my error
> didn't have a number so I used...
>
> If Err.Description = "No current record" Then Resume
> Exit_cmdDeleteWall_Click
>
> Doin' the Access Happy Dance...
> Heather
>