Re: How to suppress the "no current record" error.
- From: "Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Feb 2009 18:25:19 +1100
We seem to be talking about different things - I am assuming that you want
to get rid of that silly error message that pops up.
It is likely that the only way to stop that silly message is to change
something in the way you have the forms setup, or change the thing in your
code that makes it popup. It could well be that no amount of error trapping
will get rid of that silly message box.
The process I described should enable you to get an understanding of what it
is about your form and subform that makes this error message popup.
I am not trying to get you to stop the error, merely to get an understanding
of what part of your form/code setup causes this error message to popup so
annoyingly.
It may be that you need to change something in your code, or in the way the
2 forms are setup that will stop that silly error message from popping up.
Starting with a new form subform setup where that silly message does not
popup is the jumping off point to discover how to get rid of that message.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
"Jennifer Robertson" <jennifer@xxxxxxxxxxxxx> wrote in message
news:uQO5k0zjJHA.4028@xxxxxxxxxxxxxxxxxxxxxxx
I already know what causes the error. Its the fact that no audit record
exists for that particular permit. The audit hasn't been done yet. The
person was assigned their permit recently and the office has not gotten
around to auditing them yet. It's a fact of the process. There will always
be cases of "no current record" in this database.
The fact that the error arises is not not not not not not not the problem.
Its in the handling of the error that is.
I really appreciate the time taken by you, hth and RG, but no one has
addressed my question. I don't know how much plainer I can be in asking my
question. How do I prevent the BOX from popping up. The error can occur
because there IS an error. I just don't want the popup box.
Sorry but I'm getting really frustrated with this problem and the fact
that I can't seem to get my point across to anyone LOL
"Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23wokhozjJHA.5812@xxxxxxxxxxxxxxxxxxxxxxx
The other way to track down this error message is to create a quick and
dirty new main form and subform. Don't do any formatting or layout work.
Try using the form wizard to create the 2 forms.
It's unlikely that the new forms will give the no current record error.
If you have the new form that doesn't give the error, then you can add to
this form the code from the previous form, one routine at a time.
It's like a process of elimination. Each time you add one code routine,
test the form. Eventually you should be able to pinpoint the thing that
causes the error.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
"Jennifer Robertson" <jennifer@xxxxxxxxxxxxx> wrote in message
news:%23I5n%23hzjJHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
Hi Jeanette,
I didn't put any code on the form to save the record, but I assume
Access does something like that when I close the form. That might be
somewhere to look.
Interestingly, when I added some error trapping code (which did squat)
plus a movefirst so the main form would go back to the first record
(which by the way DOES have a record on the subform) on the main form's
On Close Event, I still got the popup box. When I clicked ok, I saw the
main form go back to the first record just before it closed the form.
So I'm pretty sure its not popping up on the main forms On close event.
I'm also pretty sure its not popping up on the On current event of both
the main and subforms as the error never pops up while I"m surfing back
and forth thru records on both main and subforms.
Or I'm not using the correct code for error trapping.
I don't think I need to avoid the error. The error can run willy nilly.
I just need to avoid the annoying popup box that I have to click closed
before I can close the form.
To recapitulate the error, have two tables. One with 10 entries
including primary key. One with 5 entries (that correspond to 5 of the
10 entries in the first table) and that links to the first via the
primary key.
Make a main form using the first table as the recordsource. Subform
using second table as the record source. Link via primary key. If you
flip through the 10 records on the main form, you will notice that 5 of
your records do not have any records on the subform. (5 of your records
will have a blank subform)
Flip to a record on the main form which does have a record on the
subform. Then click the form closed.
Try again. Flip to a record on the main form with does not have a record
on the subform. Then click the form closed. Here you should get the
popup error.
Still pluggin away.
Jen
"Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ulEUjRzjJHA.3760@xxxxxxxxxxxxxxxxxxxxxxx
Hi Jennifer,
you wrote
However if I close the
form while viewing a permit which has no recordset for audits, I get
the "no current record" error message box. If I close the form while
viewing a permit which has a recordset for audits, I do not get the
message.
When the form is closed, do you have any code that saves the current
record?
Could you be getting the no current record error when your code tries
to do something with that non existent record?
Does the main form need to do something with that non existent record?
Maybe there is a routine where you need something like:
If Me.RecordsetClone.RecordCount >0 Then
Else
'code to stop that error
End If
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
"Jennifer Robertson" <robertjv@xxxxxxxxxxx> wrote in message
news:OFdHVAtjJHA.2516@xxxxxxxxxxxxxxxxxxxxxxx
I have a form for processing of permits. On this form is a subform for
audits.
I have the subform based on a query of the audits and sorted by date.
When the subform is loaded, it moves to the last audit for that permit
holder, thus displaying the most recent audit.
That all works fine.
There are cases where the permit is new and the permit holder has not
been audited yet. The subform is blank, which is good. However if I
close the form while viewing a permit which has no recordset for
audits, I get the "no current record" error message box. If I close
the form while viewing a permit which has a recordset for audits, I do
not get the message.
The code is:
Private Sub Form_Current()
On Error Resume Next
If Me.Recordset.BOF <> Me.Recordset.EOF Then
Me.Recordset.MoveLast
End If
End Sub
How do I suppress this?
.
- Follow-Ups:
- Re: How to suppress the "no current record" error. FIXED IT!!! WOO HOO!!!
- From: Jennifer Robertson
- Re: How to suppress the "no current record" error. FIXED IT!!! WOO HOO!!!
- References:
- How to suppress the "no current record" error.
- From: Jennifer Robertson
- Re: How to suppress the "no current record" error.
- From: Jeanette Cunningham
- Re: How to suppress the "no current record" error.
- From: Jennifer Robertson
- Re: How to suppress the "no current record" error.
- From: Jeanette Cunningham
- Re: How to suppress the "no current record" error.
- From: Jennifer Robertson
- How to suppress the "no current record" error.
- Prev by Date: Re: How to suppress the "no current record" error.
- Next by Date: Re: How to suppress the "no current record" error. FIXED IT!!! WOO HOO!!!
- Previous by thread: Re: How to suppress the "no current record" error.
- Next by thread: Re: How to suppress the "no current record" error. FIXED IT!!! WOO HOO!!!
- Index(es):
Relevant Pages
|
Loading