Re: Re-post: Yet another problem with "no current record"
- From: "Laurel" <FakeMail@xxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 11:31:36 -0400
Thanks very much. It looks like your article about bug-06 is close to my
problem (haven't studied it yet). It is the case that my detail area is
completely empty, although I have no code on any of the controls except in
the AfterUpdate event. I'll mess around with this and that and may take it
to the local Users' Group. It's very helpful to be pretty sure I'm dealing
with a true weirdness here. I'll post if I figure out anything.
"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:%23V%23G72JzGHA.2516@xxxxxxxxxxxxxxxxxxxxxxx
Okay, so the error does not occur in that procedure, but occurs when you
move focus to another control if there are no records.
If so, it could be in some other code, such as the Lost Focus or Exit
event of that control, or the Got Focus or Enter of another control, or
the BeforeUpdate or AfterUpdate events of the form.
There is a case where Access 2002 SP3 generates this error message afer a
delete, but I don't see this applies.
There's another bug in JET where this error message is triggered by an
outer join query that attempts to group by a yes/no field, but again that
doesn't look like it applies. If you want to follow it up:
http://allenbrowne.com/bug-14.html
Probably worth testing if #6 from the previous reply. At least if it
solves the issue, you know what caused it. Unless it involves other code,
it should only occur if the Detail section of your form goes completely
blank, in which case the only other control you could click on would be in
the Form Header or Form Footer, and Access gets confused about the values
there. More info on this:
http://allenbrowne.com/bug-06.html
Other than that, I don't know what to suggest.
--
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.
"Laurel" <FakeMail@xxxxxxxxxxx> wrote in message
news:OGJWhCTyGHA.3492@xxxxxxxxxxxxxxxxxxxxxxx
I posted this in "getting started" almost a week ago, and my experience is
that if it isn't answered in the first day or two, it isn't going to
happen. So I'm hoping I'll get a different audience here - hope that's
alright. I've Googled "groups," and didn't find an answer. Could someone
suggest some things to try, even if you don't have a sure answer? I've
made lots of similar forms, but never had this particular problem.
****************
I have a form with 4 unbound text boxes and a button. The RecordSource
for
the form uses values in the text boxes. When I open the form, all is
fine.
No rows show because the criteria are all null and there are no rows in
the
database that match that situation (at least I assume that's why no rows
show up.) I set "No Additions" to True in my code, so no empty row shows
up
either. Once I've entered values, if the user clicks the button, then,
after a bunch of other stuff, a Me.Requery is executed and rows show up.
My problem happens after I set one of the values to -999 and execute
another
Me.Requery, to empty out the form of rows so the user can start over. (No
rows will be returned with that value). After I do that, whenever I
click
on any of the unbound text boxes or the button, I get a "No current
record"
message. I don't have to enter any data, pull down a dropdown or
anything.
And the message doesn't seem to affect the rest of the performance of the
form. The user can enter new data, click the button, and get a new set
of
records. As far as I can see this "No current record" is not tied to any
code I've written. In other words, I can't find the actual event where
the
message is being displayed in the debugger.
If I click the same text box or button a second time, the message doesn't
appear.
Again - I don't need to enter data or pull down the dropdown for the
error
to happen. Just "click". The only code I have associated with the text
boxes is "after_update" - nothing in "click".
Here's the routine that causes the problem. It is executed from the
after_update events on the controls. If I comment out the Me.Requery at
the
bottom, the problem goes away.
Any ideas?
Private Sub SetControlStates()
'This function serves as a template for other new functions
Dim ls_temp As String
On Error GoTo Err_SetControlStates
'First test for non-description re-entered on already loaded form
(need
new description)
If (cmdGO.Enabled = True) And (ib_DescriptionEntered = False) Then
[txtDescription] = ""
cmdGO.Enabled = False
GoTo RequeryPlace
Else 'Either description entered, or first time entry
If (Not (IsNull(txtGrade_Date))) And (Not
(IsNull(cboSubject_Code)))
_
And (Not (IsNull(cboType))) And (Not (IsNull(cboClass_Code)))
_
And (Not (IsNull(txtDescription)) Or (Trim(txtDescription) =
"")) Then
cmdGO.Enabled = True
Else
cmdGO.Enabled = False
End If
End If
RequeryPlace:
If Not (Me.Recordset.BOF And Me.Recordset.EOF) Then
'Empty out old records
[txtCriterion] = "-999"
' Me.Requery
Else
End If
Exit_SetControlStates:
Exit Sub
Err_SetControlStates:
ls_temp = "SetControlStates:" _
& vbCrLf & " " & Err.Description
MsgBox ls_temp
Resume Exit_SetControlStates
End Sub
.
- References:
- Re-post: Yet another problem with "no current record"
- From: Laurel
- Re: Re-post: Yet another problem with "no current record"
- From: Allen Browne
- Re-post: Yet another problem with "no current record"
- Prev by Date: Re: If statements
- Next by Date: Re: Open form listed in Text Box
- Previous by thread: Re: Re-post: Yet another problem with "no current record"
- Next by thread: How To Filter Form I Am In
- Index(es):