message after deleting the records in back-end table

How could I avoid the below message that appear to the users when they open the form after I clear out the records from the back-end database table(transfer and delete the records).
"Run-time error 3021
No current record
End Debug Help"
Thank you
marian68Asked:
Who is Participating?
 
OP_ZaharinCommented:
- this problem needs a hotfix from Microsoft. they release Access 2003 post-Service Pack 1 hotfix package for Microsoft Office Access 2003 that fixes the "Run-time error 3021" error:

http://support.microsoft.com/kb/887971
0
 
rgn2121Commented:
Not sure what you are doing without seeing code, or if this is something you need to resolve instead of just code around, but you might be able to use the code below just to hide the error if it is happening on form load.

On error goto Err_Form_Load




Exit_Form_Load:
exit sub

Err_Form_Load:
           if err.num <> 3201 then
                   'do something
           end if
         resume exit_Form_load

0
 
lluddenCommented:
DOCMD.SETWarnings False

DOCMD.SetWarnings True
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
rgn2121Commented:
oops...3021 on that error....
0
 
marian68Author Commented:
No one of the above code works.
Thank you
0
 
rgn2121Commented:
Where does the error take place...in the form load?
0
 
rgn2121Commented:
Can you post the code from the routine that errors and tell us what line it errors on?
0
 
OP_ZaharinCommented:
- download and install the hotfix from the web given above. it should corrected the problem.
0
 
marian68Author Commented:
Yes in the form load. It is the line "Me.OrderBy = "[DATE], [EXAMINER_S]" in the below code.
"Private Sub Form_Load()
Me.Filter = "[UserID]='" & fOSUserName() & "'"
Me.FilterOn = True
Me.OrderBy = "[DATE], [EXAMINER_S]"
    Me.OrderByOn = True

End Sub"
Thank you
0
 
rgn2121Commented:
If there is nothing in the recordset that the table is bound to, then it isn't going to be able to order.
You tried the code below and it didn't work?

If so, then you can check if the recordset has any records...if not then skip the filter and order by...

if Me.RecordsetClone.recordCount > 0 then
'...........
end if
Private Sub Form_Load()
On error goto Err_Form_Load


Me.Filter = "[UserID]='" & fOSUserName() & "'"
Me.FilterOn = True
Me.OrderBy = "[DATE], [EXAMINER_S]"
    Me.OrderByOn = True

Exit_Form_Load:
exit sub

Err_Form_Load:
   if err.num <> 3201 then
        'do something
   end if
   resume exit_Form_load


End Sub

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.