By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

Error 3021 no current record access 2000

P: n/a
I am writing this piece of code to show the previous record on a
control on the form but i keep getting the error message "Error 3021
no current record " and the line marked *** gets highlighted. I know
its something to do with a blank or null record as the code works fine
when i enter all details in the first record. If i omit data form the
fields relating to the second loop i get the error.

Can anyone please help????
Do

If rst!Diastolic <> rst.BOF Or rst!Diastolic <> rst.EOF Then
dias = rst!Diastolic
sys = rst!Systolic
PrevDate = rst!DATE
Else: rst.MovePrevious
End If

Loop Until dias <> ""

rst.MoveLast

Do

*** If rst!AmbSystolic <> rst.BOF Or rst!AmbSystolic <> rst.EOF
Then***
ambSys = rst!AmbSystolic
ambDias = rst!AmbDiastolic
AmbPrevDate = rst!DATE
Else: rst.MovePrevious
End If
Loop Until ambDias <> ""

rst.MoveLast
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
rst.BOF and rst.EOF will simply return True or False. So, in your If
statement, you are comparing the value of the field to True or False. Access
will interpret a value of zero as false and any other number as True. If the
field is Null, you'll get an error.

Are you simply trying to see if there are any records? If so

If Not (rst.BOF And rst.EOF) Then 'there are some records

--
Wayne Morgan
Microsoft Access MVP
"Colin Graham" <cs********@hotmail.com> wrote in message
news:ee**************************@posting.google.c om...
I am writing this piece of code to show the previous record on a
control on the form but i keep getting the error message "Error 3021
no current record " and the line marked *** gets highlighted. I know
its something to do with a blank or null record as the code works fine
when i enter all details in the first record. If i omit data form the
fields relating to the second loop i get the error.

Can anyone please help????
Do

If rst!Diastolic <> rst.BOF Or rst!Diastolic <> rst.EOF Then
dias = rst!Diastolic
sys = rst!Systolic
PrevDate = rst!DATE
Else: rst.MovePrevious
End If

Loop Until dias <> ""

rst.MoveLast

Do

*** If rst!AmbSystolic <> rst.BOF Or rst!AmbSystolic <> rst.EOF
Then***
ambSys = rst!AmbSystolic
ambDias = rst!AmbDiastolic
AmbPrevDate = rst!DATE
Else: rst.MovePrevious
End If
Loop Until ambDias <> ""

rst.MoveLast

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.