3021 Error Run Time
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of run time error 3021 no current record this site About Us Learn more about Stack Overflow the company Business Learn run time error 3021 either bof or eof is true more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Runtime Error 3021 Either Bof Or Eof Is True
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Run
Run Time Error 3021 Vb
time error 3021- no current record up vote 1 down vote favorite 1 I want to link the result of a query to a Textbox but I get this error: here is my code: Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("SELECT XValue, YValue,Wert FROM tb_DCM_Daten WHERE (FzgID=" & Forms!frm_fahrzeug!ID & " AND Name='" & List2.Value & "')") Text10.Text = rst!XValue //error in run time error 3201 this line It should be return c.a 20 record Why do I get this error and how can I solve it? thnak you vba ms-access ms-access-2010 share|improve this question asked Jun 27 '13 at 6:46 Kaja 72142035 3 Rearrange your code so your SQL Statement is in a string variable, and print it out to the immediate window. That way you'll see if there's anything wrong with it. If nothing obvious, that the output SQL and put it in a query and verify that there is a record that matches your criteria. –GregHNZ Jun 27 '13 at 6:58 Thank you, that helps –Kaja Jun 27 '13 at 7:17 add a comment| 3 Answers 3 active oldest votes up vote 5 down vote accepted One possible reason for the error is that Name is a reserved word in Access, so you should use ... & " AND [Name]='" & ... You could also test for rst.EOF before trying to use rst!XValue. That is, to verify whether or not your query is returning at least one row you can add the code If rst.EOF Then MsgBox "The
No Current Record Found If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link
Run Time Error 3021 No Current Record Access
above to proceed. To start viewing messages, select the forum that you want to runtime error 3021 in vba visit from the selection below. Results 1 to 33 of 33 Thread: [RESOLVED] Run-Time Error '3021' No Current Record Found Tweet runtime error 3021 vb6 Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 20th, 2014,12:59 PM #1 vb6coder14 View Profile View Forum Posts Thread Starter Hyperactive Member http://stackoverflow.com/questions/17336316/run-time-error-3021-no-current-record Join Date Oct 2014 Posts 261 [RESOLVED] Run-Time Error '3021' No Current Record Found I've read through the other threads on this topic but they don't seem to apply to my problem. I have a 1 row table that I'm trying to read into a recordset using VB6, but when I try to access any of the fields in the record, I get a runtime error 3021 "No current record". I http://www.vbforums.com/showthread.php?778905-RESOLVED-Run-Time-Error-3021-No-Current-Record-Found thought that when you use the Set Recordset command the recordset is populated with the contents of the target table. But that's not happening. Can someone tell me what I'm doing wrong? Any help is greatly appreciated. Here's my code: Database: MS Access Field: mpSalesRankTier1 Data type: Number Content: 10000 Number of rows in table: 1 Code: Option Explicit Public Sub modDeterminePrice() On Error GoTo ErrorRoutine Dim dbCtrlRec As Database Dim rsCtrlRec As Recordset Set dbCtrlRec = OpenDatabase(App.Path & "\" & "LLSYS.mdb") Set rsCtrlRec = dbCtrlRec.OpenRecordset("SYS_CONTROL_RECORD") MsgBox rsCtrlRec.Fields("mpSalesRankTier1") '<- Failure occurs here Exit Sub ErrorRoutine: If Err.Number > 0 Then Call gscErrRtn.gscErrRtn End If End Sub Last edited by vb6coder14; Oct 20th, 2014 at 01:03 PM. Reply With Quote Oct 20th, 2014,01:43 PM #2 jggtz View Profile View Forum Posts Frenzied Member Join Date May 2006 Location some place in the cloud Posts 1,885 Re: Run-Time Error '3021' No Current Record Found It looks like you are using DAO Then: 1 Reference the DAO library 2 Change the lines where you declare and where you open Recordset Code: Option Explicit Public Sub modDeterminePrice() On Error GoTo ErrorRoutine Dim dbCtrlRec As DAO.Database Dim rsCtrlRec As DAO.Recordset Set dbCtrlRec = OpenDatabase(App.Path & "\" & "LLSYS.mdb") Set rsCtrlRec = dbCtrlRec.OpenRecordset("SYS_CONTROL_RECORD", dbOpenTable) MsgBox rsCtrlRec.Fiel
One games Xbox 360 games PC https://support.microsoft.com/en-us/kb/966137 games Windows games Windows phone games Entertainment All https://bytes.com/topic/access/answers/920315-how-do-i-avoid-error-3021-no-current-record Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security time error Internet Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Band Microsoft time error 3021 Lumia All Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States) Terms of use Privacy & cookies Trademarks © 2016 Microsoft
Question Need help? Post your question and get tips & solutions from a community of 418,417 IT Pros & Developers. It's quick & easy. How do I Avoid Error 3021: No Current Record P: 2 psdsen Please help me for the following program problem. When I Click Next button, at the last record, it Shows --Run time error '3021': Either BOF or EOF...... Expand|Select|Wrap|Line Numbers OptionExplicit DimstrsqlAsString Dimcon_dataAsADODB.Connection Dimrs_DataAsADODB.Recordset PrivateSubForm_Load() Setcon_data=NewADODB.Connection Setrs_Data=NewADODB.Recordset con_data.Provider="Microsoft.jet.oledb.4.0;DataSource="&App.Path&"\salary97.mdb" con_data.Open strsql=("select*fromemployee") rs_Data.Openstrsql,con_data,adOpenDynamic,adLockOptimistic EndSub PrivateSubcmdnext_Click() Ifrs_Data.EOFThen rs_Data.MoveLast Else rs_Data.MoveNext EndIf txtnm.Text=rs_Data!ename EndSub Oct 22 '11 #1 Post Reply Share this Question 5 Replies Expert Mod 2.5K+ P: 2,543 Stewart Ross The error message is quite correct (although you have not posted all of it, just the start of it!). When you are already at the end of file position (in your case when rs_Data.EOF is true) you have gone past all active records, so you cannot execute a move to the last record. If you really want the last record to be the one displayed at end of file you will need to execute rs_Data.MoveFirst immediately before executing rs_Data.MoveLast. However, if there are no records at all in the table the MoveFirst will also fail with the same error message. This is where testing for both EOF and BOF being true at the same time comes in - both conditions are true simultaneously if the recordset is empty. -Stewart Oct 22 '11 #2 reply Expert Mod 15k+ P: 29,922 NeoPa Please read When Posting (VBA or SQL) Code before posting again. Oct 22 '11 #3 reply Expert 5K+ P: 8,394 ADezii This actually a little tricky since this Type of Recordset does not support the AbsolutePosition Property, and will also not give a valid RecordCount. What you can do is to Trap specific Errors, such as 3021, then move the Pointer to the Last Record and Update the Text Box: Expand|Select|Wrap|Line Numbers PrivateSubcmdNext_Click() OnErrorGoToErr_cmdNext rs_Data.MoveNext Me!txtnm=rs_Data!ename Exit_cmdNext: ExitSub Err_cmdNext: SelectCaseErr.Number Case3021,2113 rs_Data.MoveLast Me!txtnm=txtnm.Text=rs_Data!ename CaseElse MsgBoxErr.Description,vbExclamation,"ErrorincmdNext_Click()" EndSelect ResumeExit_cmdNext EndSub Oct 22 '11 #4 reply P: 2 psdsen @Stewart Its all for test purpose only. Pl