Results 1 to 3 of 3
  1. #1
    Mohanss82 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    India
    Posts
    44

    Runime Error '3021': - No current record

    Hi,

    I am noticing this error while attempting to search for an record from two tables. Initially it worked with one table alone which just returns no records, But now I am looking for 2 tables where the 2nd Table gets returned in a label value. When I debug the error, it stops at the below line. I have attached the code as well. pls assist.



    varReturnValue = CurrentDb.OpenRecordset(Query)(0)

    Click image for larger version. 

Name:	3021.JPG 
Views:	14 
Size:	17.3 KB 
ID:	25102
    Attached Files Attached Files

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    What is the purpose of (0) at the end of the code line.
    BTW "query" is a reserved word in Access.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Under the section of code 'Contract No

    Not sure exactly what you are trying to do, but there are errors in the code.

    AS [Cheques@ Vault]
    Error: Using a special character in a column name (the "@" sign)
    Use [ChequesVault] ' note: NO space
    ------------------------
    WHERE ((([tbl_Citi Summary].[Contract Nos])LIKE " & Me.txtContractNumber
    Error: Missing a space before "Like"
    ------------------------
    Query = "SELECT [tbl_Citi Summary].[
    Error: "Quote" is a reserved word in Access and shouldn't be used as an object name.
    ------------------------
    Dim varReturnValue As Variant
    varReturnValue = CurrentDb.OpenRecordset(Query)(0)
    Error:you are trying to assign a recordset to a variant type variable.
    ------------------------
    CurrentDb.OpenRecordset(Query)(0)
    Error: Don't know what the "(0)" is for
    ------------------------


    I can't text this code, so BE AWARE the changes are AIR code............
    See attached file
    Attached Files Attached Files

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

Similar Threads

  1. No current recpord. 3021
    By gg80 in forum Programming
    Replies: 11
    Last Post: 05-05-2015, 07:05 PM
  2. sql error . runtime 3021 - no current record
    By princess12 in forum Access
    Replies: 3
    Last Post: 04-10-2015, 09:26 AM
  3. Error 3021 no current record
    By bbrazeau in forum Programming
    Replies: 10
    Last Post: 12-13-2012, 04:22 PM
  4. Error 3021
    By Marianna_Air in forum Forms
    Replies: 27
    Last Post: 08-20-2012, 01:13 PM
  5. Replies: 8
    Last Post: 05-16-2011, 06:01 PM

Tags for this Thread

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