| re: Error 3021 no current record access 2000
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" <csgraham74@hotmail.com> wrote in message
news:ee261922.0312220509.78b6cec0@posting.google.c om...[color=blue]
> 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[/color] |