473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Error 3021 no current record access 2000

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
1 6964
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Robert Wing | last post by:
I support an MS Access application in which errors are trapped using the On Error statement. Just recently, the users of this system have experienced run-time error number 3021 on a random basis. ...
2
by: John Sims | last post by:
Hello All, Anybody out there know what this error is...I'm getting it while trying to create a partial replica from a full replica made from the design master. "The Partial Replica Wizard has...
2
by: dixie | last post by:
Can someone please give me the error number for this error? dixie
3
by: windandwaves | last post by:
Hi, I am trying to make errors a bit more meaningful for my users. I am trying to fix error 3201 where there is a missing field in a form. If I do not do any error trapping, then I get ...
2
by: Robert | last post by:
I have a label on my form lblCount and the following code in my form for displaying a record count: Private Sub Form_Current() Me.RecordsetClone.Bookmark = Me.Bookmark Me!lblCount.Caption =...
0
by: user_5701 | last post by:
I have an Access 97 database front end (with some lookup tables there too) which also has a MS SQL Server 2000 back end, where all the rest of the larger tables are. I recently had some problems...
5
by: prakashwadhwani | last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in my form were working perfectly. However, after I added a call to the "Save_Fields_In_Form_Header" Event/Proc in the...
4
by: Oseyo | last post by:
I'm working with Access 2000 Version 9.0. I closed a Database that i was working on and on opening it up again an Error Message displayed "No Current Record" the Help File displays the Error Code as...
0
by: bssandeshbs | last post by:
I am developing a Address Book Database Project using Visual Basic 6... When i click the delete button the data does'nt get deleted in the FrontEnd ..But it gets deleted in Database when we see in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.