Results 1 to 4 of 4
  1. #1
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22

    Error 3021 on a few workstations

    I am getting a 3021 No record found error on some workstations. They are running Access 2013 runtime, though the database is coded in 2007.

    It doesn't happen for all workstations running this runtime version. It doesn't happen for users with full access installed.


    Private Sub ApplyNewFilter()






    On Error GoTo errHandler

    Select Case cboFilter.Value
    Case "All"
    Me.Filter = ""
    Case "Active"
    Me.Filter = "Status = ""Active"""
    Case "Pending closure"
    Me.Filter = "PendingClosure = True"
    Case "High level"
    Me.Filter = "Level_of_Inspection = ""High"""
    Case "Medium level"


    Me.Filter = "Level_of_Inspection = ""Medium"""
    Case "Low level"
    Me.Filter = "Level_of_Inspection = ""Low"""
    Case "100% level"
    Me.Filter = "Level_of_Inspection = ""100%"""
    Case "Stock Code"
    If Not IsNull(cboFiltCond.Value) Then
    Me.Filter = "[Part_Number] = """ + cboFiltCond.Value + """"
    Else
    Me.Filter = "[Part_Number] is null"
    End If


    cboFiltCond.Visible = True
    End Select


    Me.FilterOn = Not cboFilter.Value = "All"

    If Not cboFilter.Value = "Stock Code" Then
    cboFilter.SetFocus
    cboFiltCond.Visible = False
    End If
    GoTo endsub


    errHandler:
    MsgBox Err.Number & ": " & Err.Description, vbOKOnly, "Error : " & Err.Source

    endsub:
    End Sub

    Click image for larger version. 

Name:	pic1.png 
Views:	12 
Size:	20.8 KB 
ID:	17180

    The error is happening somewhere in the Select Case loop

    Any help much appreciated

    regards
    Simon

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    It's a bit of a guess, but what might be happening is that when the filter is turned on, no records qualify to be displayed, so the cboFilter.setfocus (?) command fails.

    See if you can isolate exactly what users who get the error are doing when the error occurs; there are all kinds of things that could be causing it. If you are using user log-in and permissions - can users who get the error log in on a full version of Access and do the same thing without the error?

    John

  3. #3
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22
    Thanks John.

    I have noticed on doing a bit more testing, that the unbound field called cbofilter should have a default value of "Active" when the form is displayed. It does if you open the application in a full copy of Access 2007, but it's empty if you open it in Access 2013 runtime - though this may be momentarily before the error occurs.

    I have tried making the first line of the sub

    if cbofilter.value="" then cbofilter.value = "Active"

    but this line alone causes the same error to appear.

    regards
    Simon

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Unless Active is a boolean (Yes/No) type, the filter syntax is wrong - it has to include a fieldname:

    if cbofilter.value="" then cbofilter.value = "fieldname = 'Active'"

    That error may in fact be causing it to exclude all records, because it is not detecting "Active" as an error.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Single Macro Error 3021
    By qzx999 in forum Macros
    Replies: 17
    Last Post: 07-05-2013, 06:46 PM
  2. 3021 Error
    By RonL in forum Programming
    Replies: 6
    Last Post: 05-10-2013, 03:45 PM
  3. Error 3021
    By Marianna_Air in forum Forms
    Replies: 27
    Last Post: 08-20-2012, 01:13 PM
  4. Replies: 8
    Last Post: 05-16-2011, 06:01 PM
  5. Runtime Error 3021
    By paddon in forum Programming
    Replies: 12
    Last Post: 03-14-2011, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums