Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

3021:no current record

Posted on 2008-10-07
12
Medium Priority
?
285 Views
Last Modified: 2013-11-28
when i select some data in drop down box for creating a report and click the create report button . I am getting the error "3021:no current record"

but some time not... please help me !!

0
Comment
Question by:jaisonshereen
[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
  • 8
  • 4
12 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22661184
post the codes in the click event of the button
0
 

Author Comment

by:jaisonshereen
ID: 22661198
This is the code for click button :


Private Sub Cmd_rief_Click()
On Error GoTo Err_Cmd_rief_Click
 
    Call Project1.Form_T_GeneralSearch.CheckForNullSearch
    
    FixSearchCriteria
    
    DoCmd.OpenReport "T_riefReport", acViewPreview
 
Exit_Cmd_rief_Click:
    Exit Sub
 
Err_Cmd_rief_Click:
    ApplicationError Err.Number, Err.Description, "Form_T_ViewRollupPromotions\Cmd_rief_Click"
    Resume Exit_Cmd_rief_Click
 
End Sub

Open in new window

0
 

Author Comment

by:jaisonshereen
ID: 22661235

Public Sub FixSearchCriteria()
On Error GoTo Err_FixSearchCriteria
 
    CurrentProject.Connection.Execute "DELETE * FROM T_TempSearch"
    
    DoCmd.SetWarnings False
    DoCmd.RunSQL "DELETE * FROM T_TempSearch"
    DoCmd.OpenQuery "T_SearchFixSearchCriteriaFix"
       
Exit_FixSearchCriteria:
    Exit Sub
 
Err_FixSearchCriteria:
    ApplicationError Err.Number, Err.Description, "Module1\FixSearchCriteria"
    Resume Exit_FixSearchCriteria
    
End Sub

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jaisonshereen
ID: 22661240

Public Sub CheckForNullSearch()
On Error GoTo Err_CheckForNullSearch
    
    'Checks general search form for any nulls
    'Dirty = False
    
    If IsNull(Me.Combo_Year) Or Me.Combo_Year = "0" Or Me.Combo_Year = "" Then Me.Combo_Year = "Year"
    If IsNull(Me.Combo_TempPromoID) Or Me.Combo_TempPromoID = "" Then Me.Combo_TempPromoID = "0"
    If IsNull(Me.Combo_EnteredBy) Or Me.Combo_EnteredBy = "0" Or Me.Combo_EnteredBy = "" Then Me.Combo_EnteredBy = "Log on"
    If IsNull(Me.Combo_PromoPeriod) Or Me.Combo_PromoPeriod = "0" Or Me.Combo_PromoPeriod = "" Then Me.Combo_PromoPeriod = "Period"
    If IsNull(Me.Combo_Location) Or Me.Combo_Location = "" Or Me.Combo_Location = "" Then Me.Combo_Location = "Location"
    If IsNull(Me.Combo_CategoryMan) Or Me.Combo_CategoryMan = "0" Or Me.Combo_CategoryMan = "" Then Me.Combo_CategoryMan = "Category Manager"
    If IsNull(Me.Combo_CatID) Or Me.Combo_CatID = "" Then Me.Combo_CatID = "0"
    If IsNull(Me.Combo_StartDate) Or Me.Combo_StartDate = "" Or Me.Combo_StartDate = "0" Then Me.Combo_StartDate = "Start Date"
    If IsNull(Me.Combo_Status) Or Me.Combo_Status = "" Or Me.Combo_Status = "0" Then Me.Combo_Status = "Status"
    If IsNull(Me.Combo_article) Or Me.Combo_article = "" Or Me.Combo_article = "0" Then Me.Combo_article = "0"
    
    'Dirty = False
    
Exit_CheckForNullSearch:
    Exit Sub
 
Err_CheckForNullSearch:
    
    'Entered an item not in the list
    If Err.Number = 2237 Then Resume Next
    
    'If a Null value after the dirty=false then error will occur
    If Err.Number = 3058 Then Resume Next
                        
    'No current record
    If Err.Number = 3021 Then Resume Next
                        
    ApplicationError Err.Number, Err.Description, "T_F900_GeneralSearch\CheckForNullSearch"
    Resume Exit_CheckForNullSearch
    
End Sub

Open in new window

0
 

Author Comment

by:jaisonshereen
ID: 22661243
let me know any other code u want of any functions above!
0
 

Author Comment

by:jaisonshereen
ID: 22661252
u want the query "  DoCmd.OpenQuery "T_SearchFixSearchCriteriaFix""?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22661257

comment the same lines like the one posted below

now select the same value from the combo that gives error and click the button

see if you will still get the error. post here the result
Private Sub Cmd_rief_Click()
On Error GoTo Err_Cmd_rief_Click
 
 '   Call Project1.Form_T_GeneralSearch.CheckForNullSearch
    
 '   FixSearchCriteria
    
    DoCmd.OpenReport "T_riefReport", acViewPreview
 
Exit_Cmd_rief_Click:
    Exit Sub
 
Err_Cmd_rief_Click:
    ApplicationError Err.Number, Err.Description, "Form_T_ViewRollupPromotions\Cmd_rief_Click"
    Resume Exit_Cmd_rief_Click
 
End Sub

Open in new window

0
 

Author Comment

by:jaisonshereen
ID: 22661325
yes its worked !!! thanks a lot

can u tell what was wrong inside the "CheckForNullSearch"

so that i can debug inside the function  and un comment it to work ?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22661393
not yet we commented two lines.

now uncomment the first one and try again

   Call Project1.Form_T_GeneralSearch.CheckForNullSearch
0
 

Author Comment

by:jaisonshereen
ID: 22661417
oops ..last time i did the same

i commented only "Call Project1.Form_T_GeneralSearch.CheckForNullSearch"

it was working fine ... !!

do i need to comment "'   FixSearchCriteria" and check again?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 22661480
no need, the problem is coming from CheckForNullSearch
modify this part of the codes






 
    'No current record
    If Err.Number = 3021 Then 
       err.clear
       Resume Next
    else                    
    ApplicationError Err.Number, Err.Description, "T_F900_GeneralSearch\CheckForNullSearch"
    Resume Exit_CheckForNullSearch
 
    end if

Open in new window

0
 

Author Comment

by:jaisonshereen
ID: 22661599
Thanks dude ... thanks a million ton !!

Cheers !!
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

636 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