A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"No Current Record" when adding new record



 
 
Thread Tools Display Modes
  #1  
Old July 6th, 2009, 04:22 PM posted to microsoft.public.access
TraciAnn via AccessMonster.com
external usenet poster
 
Posts: 178
Default "No Current Record" when adding new record

Hi All,

I have a main form (frmFacility) with a subform (fsubTraining) with a subform
(fsubUserTraining).

Whenever I add a new record, while inserting characters in the first field, I
receive a message box "No Current Record". After clicking "OK" I am able to
continue and the record is inserted with no additional problems.

I believe it may have to do with my OnCurrent Event for the form.
==================
Private Sub Form_Current()
On Error GoTo Err_Form_Current

Me.cboFindFacility.Value = Me.FacilityID

If Me.FilterOn Then
Me.cboFindFacility.Enabled = False
Else
Me.cboFindFacility.Enabled = True
End If

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)
Me.cmdPreviousFacility.Visible = True = (Me.CurrentRecord 1)
Me.RecordsetClone.MoveLast 'could be any ie: Movefirst
Me.cmdNextFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)
Me.cmdGoToLastFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)

Exit_Form_Current:
Exit Sub

Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current

End Sub
==================
Any ideas?

Thanks!

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1

  #2  
Old July 6th, 2009, 05:50 PM posted to microsoft.public.access
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default "No Current Record" when adding new record

Hi TraciAnn -

I believe it may have to do with my OnCurrent Event for the form.


I believe you're right grin.

Here's a code snippet I use to test for an empty recordset; I failed to
record which one of the regulars here gave me the tip:

If Not (Me.Recordset.BOF AND Me.Recordset.EOF) Then 'skip all if
empty recordset
rem execute this code only if non-empty recordset
End If

Just a comment on style (personal preference?) -- if it were my code,
I'd change lines such as

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)


to

Me.cmdGoToFirstFacility.Visible = (True = (Me.CurrentRecord 1))

just for readability.

--
Clif

"TraciAnn via AccessMonster.com" u50702@uwe wrote in message
news:98ac7c9cb7430@uwe...
Hi All,

I have a main form (frmFacility) with a subform (fsubTraining) with a
subform
(fsubUserTraining).

Whenever I add a new record, while inserting characters in the first
field, I
receive a message box "No Current Record". After clicking "OK" I am
able to
continue and the record is inserted with no additional problems.

I believe it may have to do with my OnCurrent Event for the form.
==================
Private Sub Form_Current()
On Error GoTo Err_Form_Current

Me.cboFindFacility.Value = Me.FacilityID

If Me.FilterOn Then
Me.cboFindFacility.Enabled = False
Else
Me.cboFindFacility.Enabled = True
End If

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)
Me.cmdPreviousFacility.Visible = True = (Me.CurrentRecord 1)
Me.RecordsetClone.MoveLast 'could be any ie: Movefirst
Me.cmdNextFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)
Me.cmdGoToLastFacility.Visible = True = (Me.CurrentRecord _
Me.RecordsetClone.RecordCount)

Exit_Form_Current:
Exit Sub

Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current

End Sub
==================
Any ideas?

Thanks!

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1




--
Clif


  #3  
Old July 6th, 2009, 05:59 PM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default "No Current Record" when adding new record

"Clif McIrvin" wrote in message
...
Just a comment on style (personal preference?) -- if it were my code, I'd
change lines such as

Me.cmdGoToFirstFacility.Visible = True = (Me.CurrentRecord 1)


to

Me.cmdGoToFirstFacility.Visible = (True = (Me.CurrentRecord 1))


I'd go even farther and write it as

Me.cmdGoToFirstFacility.Visible = (Me.CurrentRecord 1)

Maybe it's just me, but that seems to me to be the clearest statement (as
long as one wishes to be succinct).

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #4  
Old July 6th, 2009, 06:38 PM posted to microsoft.public.access
TraciAnn via AccessMonster.com
external usenet poster
 
Posts: 178
Default "No Current Record" when adding new record

Clif,

I believe it may have to do with my OnCurrent Event for the form.

I believe you're right grin.


Actually, I think I'm wrong.

It is happening with the creation of the new record on frmFacility but not
having an associated record on fsubTraining.

This doesn't happen on any of my other Form.subForm relationships so I'm not
sure what is causing it.

Any other ideas?

Here's a code snippet I use to test for an empty recordset;


Thanks for the code. I think that will come in handy for several places in
this app.

Just a comment on style (personal preference?) -- if it were my code,
I'd change lines such as


I always appreciate constructive criticism. Good advice...well taken ;-)

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1

  #5  
Old July 6th, 2009, 06:56 PM posted to microsoft.public.access
TraciAnn via AccessMonster.com
external usenet poster
 
Posts: 178
Default "No Current Record" when adding new record

Clif,

Did you happen to see my post on "SQL Backend way to slow"?

Albert has taken me almost all the way to there but I just don't understand
the Select Case statement well enough to bring it to completion.

Are you able to add any insight to that thread?

Thanks for all your help! It isn't taken for granted!

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1

  #6  
Old July 6th, 2009, 07:05 PM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default "No Current Record" when adding new record

The most likely culprit, I'd guess, is the parent form's BeforeInsert event
procedure as this is executed as soon as the user enters any data into the
form while at a new record. I'd look there for any code which references the
subform, as at this stage the latter's underlying recordset will be empty of
course. If there is such code then make it conditional on:

If Not Me.Newrecord Then

If the culprit is not code in this event procedure look for something similar
elsewhere in the form's module. If you do find something which looks like a
possible suspect then you can of course put a breakpoint in the code and then
step into it line by line with the F8 key when it stops at the breakpoint to
see which line is producing the error.

Ken Sheridan
Stafford, England

TraciAnn wrote:
Clif,

I believe it may have to do with my OnCurrent Event for the form.

I believe you're right grin.


Actually, I think I'm wrong.

It is happening with the creation of the new record on frmFacility but not
having an associated record on fsubTraining.

This doesn't happen on any of my other Form.subForm relationships so I'm not
sure what is causing it.

Any other ideas?

Here's a code snippet I use to test for an empty recordset;


Thanks for the code. I think that will come in handy for several places in
this app.

Just a comment on style (personal preference?) -- if it were my code,
I'd change lines such as


I always appreciate constructive criticism. Good advice...well taken ;-)


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1

  #7  
Old July 6th, 2009, 11:07 PM posted to microsoft.public.access,microsoft.public.access.forms
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default "No Current Record" when adding new record

"TraciAnn via AccessMonster.com" u50702@uwe wrote in message
news:98add45ea00f3@uwe...
Clif,

Did you happen to see my post on "SQL Backend way to slow"?


Actually, no ... I only monitor microsoft.public.access and that thread
is under microsoft.public.access.forms .... I never looked at
AccessMonster carefully enough to be confident of how they link to the
various microsoft.public.access.* newsgroups. Go ahead and continue that
thread as long as you're working on the same issue ... it keeps all the
discussion history intact.



Albert has taken me almost all the way to there but I just don't
understand
the Select Case statement well enough to bring it to completion.


You're getting there ... you have:

=======
Select Case TabUserInfo

Case 1
If Me.fsubCommunication.SourceObject = "" Then
Me.fsubCommunication.SourceObject = "fsubCommunication"
Me.fsubCommunication.LinkChildFields = "UserName"
Me.fsubCommunication.LinkMasterFields = "UserName"
Me.fsubCommunication.Form.RecordSource =
"qryFormfsubCommunication"


Case 2
If Me.fsubUserTraining.SourceObject = "" Then
(etc)

========

change it to:

Select Case TabUserInfo


Case 1
If Me.fsubCommunication.SourceObject = "" Then
Me.fsubCommunication.SourceObject = "fsubCommunication"
Me.fsubCommunication.LinkChildFields = "UserName"
Me.fsubCommunication.LinkMasterFields = "UserName"
Me.fsubCommunication.Form.RecordSource =
"qryFormfsubCommunication"
End If


Case 2
If Me.fsubUserTraining.SourceObject = "" Then
(code)
End If


(etc.)


Basically I just skimmed through the thread and when I saw the missing
End If I quit looking .... if that doesn't get you on your way post
back.


--
Clif



PS: Are you getting Alberts samples figured out? I've noticed he
approaches problem solving with Access somewhat differently than I (and
many others) do .... and I find that I like what I've taken the time to
study and understand!


  #8  
Old July 6th, 2009, 11:12 PM posted to microsoft.public.access,microsoft.public.access.forms
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default "No Current Record" when adding new record

Oops ... I tried to tie into a thread from a different newsgroup ... and
didn't take time to think about the threading and subject headers.

My apologies for the orphan post and any confusion it causes.

--
Clif

"Clif McIrvin" wrote in message
...
"TraciAnn via AccessMonster.com" u50702@uwe wrote in message
news:98add45ea00f3@uwe...
Clif,

Did you happen to see my post on "SQL Backend way to slow"?


Actually, no ... I only monitor microsoft.public.access and that
thread is under microsoft.public.access.forms .... I never looked at
AccessMonster carefully enough to be confident of how they link to the
various microsoft.public.access.* newsgroups. Go ahead and continue
that thread as long as you're working on the same issue ... it keeps
all the discussion history intact.



Albert has taken me almost all the way to there but I just don't
understand
the Select Case statement well enough to bring it to completion.


You're getting there ... you have:

=======
Select Case TabUserInfo

Case 1
If Me.fsubCommunication.SourceObject = "" Then
Me.fsubCommunication.SourceObject = "fsubCommunication"
Me.fsubCommunication.LinkChildFields = "UserName"
Me.fsubCommunication.LinkMasterFields = "UserName"
Me.fsubCommunication.Form.RecordSource =
"qryFormfsubCommunication"


Case 2
If Me.fsubUserTraining.SourceObject = "" Then
(etc)

========

change it to:

Select Case TabUserInfo


Case 1
If Me.fsubCommunication.SourceObject = "" Then
Me.fsubCommunication.SourceObject = "fsubCommunication"
Me.fsubCommunication.LinkChildFields = "UserName"
Me.fsubCommunication.LinkMasterFields = "UserName"
Me.fsubCommunication.Form.RecordSource =
"qryFormfsubCommunication"
End If


Case 2
If Me.fsubUserTraining.SourceObject = "" Then
(code)
End If


(etc.)


Basically I just skimmed through the thread and when I saw the missing
End If I quit looking .... if that doesn't get you on your way post
back.


--
Clif



PS: Are you getting Alberts samples figured out? I've noticed he
approaches problem solving with Access somewhat differently than I
(and many others) do .... and I find that I like what I've taken the
time to study and understand!





--
Clif


  #9  
Old July 8th, 2009, 03:00 PM posted to microsoft.public.access
TraciAnn via AccessMonster.com
external usenet poster
 
Posts: 178
Default "No Current Record" when adding new record

Ken,

The most likely culprit, I'd guess, is the parent form's BeforeInsert event


I only have Events for Current, Open and AfterInsert on forms

If Not Me.Newrecord Then


However, I inserted the statement at the beginning of the OnCurrent event and
it took care of the problem. (on a couple forms)!

Thanks!

--
---
TraciAnn

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.