PC Review


Reply
Thread Tools Rate Thread

Why "no current record?"

 
 
LAS
Guest
Posts: n/a
 
      7th Sep 2010
Me.Recordset.AddNew
Me.Recordset.Edit 'I GET A NO CURRENT RECORD ERROR AT THIS POINT - HOW
COME????
Me!Student_ID = cboStudent_ID

This form was working fine until I discovered that it was creating rows with
missing data. I didn't want a row created until certain data was entered,
so I moved the assignments earlier. Now I'm getting this.

What am I doing wrong besides trying to manage my form outside of "the
Access way?" Can someone just addres the coding issues here, rather than
the decision to try to use code?

TIA
LAS


 
Reply With Quote
 
 
 
 
Bob Quintal
Guest
Posts: n/a
 
      7th Sep 2010
"LAS" <(E-Mail Removed)> wrote in
news:i648t8$hqh$(E-Mail Removed):

> Me.Recordset.AddNew
> Me.Recordset.Edit 'I GET A NO CURRENT RECORD ERROR AT THIS
> POINT - HOW
> COME????
> Me!Student_ID = cboStudent_ID
>
> This form was working fine until I discovered that it was creating
> rows with missing data. I didn't want a row created until certain
> data was entered, so I moved the assignments earlier. Now I'm
> getting this.
>
> What am I doing wrong besides trying to manage my form outside of
> "the Access way?" Can someone just addres the coding issues here,
> rather than the decision to try to use code?
>
> TIA
> LAS
>

What you are doing is confusing Access. First you tell Access to add a
new record, which clears certain pointers in the recordset, then,
before you have entered any data and saved the record you tell Access
to edit the current record, which does not yet exist.

Just remove the Me.Recordset.Edit line and your code will work.
--
Bob Q.
PA is y I've altered my address.
 
Reply With Quote
 
 
 
 
LAS
Guest
Posts: n/a
 
      7th Sep 2010
Thanks. I think I knew that once... :-)

"Bob Quintal" <(E-Mail Removed)> wrote in message
news:Xns9DEC410021ABEBQuintal@69.16.185.250...
> "LAS" <(E-Mail Removed)> wrote in
> news:i648t8$hqh$(E-Mail Removed):
>
>> Me.Recordset.AddNew
>> Me.Recordset.Edit 'I GET A NO CURRENT RECORD ERROR AT THIS
>> POINT - HOW
>> COME????
>> Me!Student_ID = cboStudent_ID
>>
>> This form was working fine until I discovered that it was creating
>> rows with missing data. I didn't want a row created until certain
>> data was entered, so I moved the assignments earlier. Now I'm
>> getting this.
>>
>> What am I doing wrong besides trying to manage my form outside of
>> "the Access way?" Can someone just addres the coding issues here,
>> rather than the decision to try to use code?
>>
>> TIA
>> LAS
>>

> What you are doing is confusing Access. First you tell Access to add a
> new record, which clears certain pointers in the recordset, then,
> before you have entered any data and saved the record you tell Access
> to edit the current record, which does not yet exist.
>
> Just remove the Me.Recordset.Edit line and your code will work.
> --
> Bob Q.
> PA is y I've altered my address.



 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      7th Sep 2010
"LAS" <(E-Mail Removed)> wrote in
news:i648t8$hqh$(E-Mail Removed):

> Me.Recordset.AddNew
> Me.Recordset.Edit 'I GET A NO CURRENT RECORD ERROR AT THIS
> POINT - HOW
> COME????
> Me!Student_ID = cboStudent_ID


You're mixing recordset and form editing. The .AddNew creates a new
record in the form's underlying recordset and displays it in the
form's display and edit buffers. You aren't editing the recordset,
since you're using the form's edit buffer, not the form's recordset,
to assign the value. Thus, you don't need the .Edit, as you aren't
editing the recordset in the first place.

Again, I keep telling you this -- just stop using the form's
recordset and you'll avoid all these kinds of problems. You're
trying to work with data in the form the way you work with data in a
recordset in code, and this is antithetical to the whole point of
bound Access forms.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      8th Sep 2010
"LAS" <(E-Mail Removed)> wrote in
news:i68npk$ovb$(E-Mail Removed):

> OK, to "stop working with the form's recordset," can I just change
> the statements here???


Well, you're using the recordset to create a new record. Instead,
you could use:

DoCmd.GoToRecord acForm, "MyForm", acNewRec

You don't need the Me.Recordset.Edit even if you're using the
recordset to add the new record, so all you really have to do is
remove the .Edit and it should work.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
current week, current month, current year joemeshuggah Microsoft Excel Programming 1 14th Oct 2008 06:44 PM
why why why why why Mr. SweatyFinger Microsoft ASP .NET 4 21st Dec 2006 02:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger Microsoft ASP .NET 2 2nd Dec 2006 04:46 PM
Why?Why?Why?Why? Doug Microsoft Word New Users 4 8th Jun 2004 05:28 PM
The current time on this computer and the current time on the network are differ Dwaine Windows XP Networking 2 2nd Mar 2004 02:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:11 PM.