Results 1 to 4 of 4
  1. #1
    princess12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    79

    sql error . runtime 3021 - no current record

    Hi everyone,

    i have a checkout room form where after customers check in room, the form updatess the checkinout table to check out.

    the error i get is from the sql and it on the dates line, even though the query works perfectly with accurate results

    sql = "SELECT * " & _
    "FROM checkinout " & _
    "WHERE CustomerId = " & Me.listbox.Column(0) & "" & _
    " AND RoomNo = " & Me.listbox.Column(3) & "" & _
    " AND CheckInDate = #" & Me.listbox.Column(4) & "#"


    Set db = CurrentDb
    Set rst = db.OpenRecordset(sql)



    With rst
    .Edit


    rst!CheckOutDate = Me.txtbox1
    ....


    could someone please point me to the right direction

    thanks alot

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Why doesn't your table have a unique identifier? A unique identifier would help you identify a record by a single field.

    Is your room number an actual number? Have you tried debug.print SQL to see what your string is returning? If you cut and paste that string into a query window does it return the expected results?

    Have you tried rst!checkoutdate = "#" & me.txtbox1 & "#"

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,043
    Hi,

    before you can move through a recordset you have to check if there are any records. You can do so by checking if rst.BOF (Begin Of File) = rst.EOF (End Of File). If this is the case, the recordset is empty.

  4. #4
    princess12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    79
    thanks for suggestions, it helped me fixed it, sorry for the trouble.

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

Similar Threads

  1. 3021 Error
    By RonL in forum Programming
    Replies: 6
    Last Post: 05-10-2013, 03:45 PM
  2. Error 3021 no current record
    By bbrazeau in forum Programming
    Replies: 10
    Last Post: 12-13-2012, 04:22 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