Solved

message after deleting the records in back-end table

Posted on 2011-03-22
10
266 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:marian68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 12

Expert Comment

by:rgn2121
ID: 35189431
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
 
LVL 18

Expert Comment

by:lludden
ID: 35189435
DOCMD.SETWarnings False

DOCMD.SetWarnings True
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 35189439
oops...3021 on that error....
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:marian68
ID: 35189530
No one of the above code works.
Thank you
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 35189568
Where does the error take place...in the form load?
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 35189576
Can you post the code from the routine that errors and tell us what line it errors on?
0
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 250 total points
ID: 35189611
- 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
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35189628
- download and install the hotfix from the web given above. it should corrected the problem.
0
 

Author Comment

by:marian68
ID: 35189629
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
 
LVL 12

Assisted Solution

by:rgn2121
rgn2121 earned 250 total points
ID: 35189704
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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question