ACCESS: 3021 Error - No Current Record Found

Hi, 

Does anyone know how I can stop the above error happening?

Thanks.

 
Question Info

Last updated August 7, 2018 Views 33,451 Applies to:
Answer

between these lines in the function:

    xlWSh.Range("A1").Select

    For Each fld In rst.Fields

 

put

 

If rst.RecordCount = 0 Then

    Msgbox "There are no records to export"

    Exit Function

End If


Bob Larson, Former Access MVP (2008-2010) http://www.btabdevelopment.com (free Access tools, tutorials, and samples)
-----
Microsoft Access MVP 2008, 2009, 2011
If a post was helpful click the FOUND THIS HELPFUL link

24 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.