473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Run-time error 3021. No current record

3
When i copy data form to multiple form i get a "Run-time error 3021. No current record " in the line "rst2.MoveLast"...Can you help me out...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Process_AfterUpdate()
  2. Dim db As DAO.Database
  3. Dim rst11 As DAO.Recordset
  4. Dim rst10 As DAO.Recordset
  5. Dim rst9 As DAO.Recordset
  6. Dim rst8 As DAO.Recordset
  7. Dim rst7 As DAO.Recordset
  8. Dim rst6 As DAO.Recordset
  9. Dim rst5 As DAO.Recordset
  10. Dim rst4 As DAO.Recordset
  11. Dim rst3 As DAO.Recordset
  12. Dim rst2 As DAO.Recordset
  13. Dim rst1 As DAO.Recordset
  14.  
  15. Set rst11 = Forms!frm_BIA!frm_jobtraing.Form.RecordsetClone
  16. Set rst10 = Forms!frm_BIA!frm_Vtlrcrd.Form.RecordsetClone
  17. Set rst9 = Forms!frm_BIA!frm_off_telrequ.Form.RecordsetClone
  18. Set rst8 = Forms!frm_BIA!frm_othrasset.Form.RecordsetClone
  19. Set rst7 = Forms!frm_BIA!frm_sffreq.Form.RecordsetClone
  20. Set rst6 = Forms!frm_BIA!frm_essintrcntrct_con.Form.RecordsetClone
  21. Set rst5 = Forms!frm_BIA!frm_mnulprcdre.Form.RecordsetClone
  22. Set rst4 = Forms!frm_BIA!frm_resorcsrequrmnt.Form.RecordsetClone
  23. Set rst3 = Forms!frm_BIA!frm_endtoendprcs.Form.RecordsetClone
  24. Set rst2 = Forms!frm_BIA!frm_prcscrticl_crtria_crtocatybase.Form.RecordsetClone
  25. Set rst1 = Forms!frm_BIA!frm_SignOff.Form.RecordsetClone
  26.  
  27. 'find the current record
  28. 'rst1.FindFirst "ID = " & Me.ID
  29.  
  30. rst2.MoveLast
  31. Do While Not rst2.EOF
  32. If rst2.AbsolutePosition = rst1.AbsolutePosition Then
  33. rst2.Edit
  34. rst2!Process = Me.Process
  35. rst2.Update
  36. rst3.Edit
  37. rst3!Process = Me.Process
  38. rst3.Update
  39. rst4.Edit
  40. rst4!Process = Me.Process
  41. rst4.Update
  42. rst5.Edit
  43. rst5!Process = Me.Process
  44. rst5.Update
  45. rst6.Edit
  46. rst6!Process = Me.Process
  47. rst6.Update
  48. rst7.Edit
  49. rst7!Process = Me.Process
  50. rst7.Update
  51. rst8.Edit
  52. rst8!Process = Me.Process
  53. rst8.Update
  54. rst9.Edit
  55. rst9!Process = Me.Process
  56. rst9.Update
  57. rst10.Edit
  58. rst10!Process = Me.Process
  59. rst10.Update
  60. rst11.Edit
  61. rst11!Process = Me.Process
  62. rst11.Update
  63.  
  64. Exit Do
  65. Else
  66. rst2.MoveNext
  67. rst3.MoveNext
  68. rst4.MoveNext
  69. rst5.MoveNext
  70. rst6.MoveNext
  71. rst7.MoveNext
  72. rst8.MoveNext
  73. rst9.MoveNext
  74. rst10.MoveNext
  75. rst11.MoveNext
  76.  
  77. End If
  78. Loop
  79. rst1.Close
  80. rst2.Close
  81. rst3.Close
  82. rst4.Close
  83. rst5.Close
  84. rst6.Close
  85. rst7.Close
  86. rst8.Close
  87. rst9.Close
  88. rst10.Close
  89. rst11.Close
  90.  
  91. Set rst1 = Nothing
  92. Set rst1 = Nothing
  93.  
  94. End Sub
Nov 6 '10 #1
7 5928
NeoPa
32,556 Expert Mod 16PB
Joseph, why don't you strip out all the irrelevant code from this (most of it) and come back with a question that's clearly asked and pertaining to the problem code only.

I expect once you tidy it up a bit your problem will become obvious anyway.
Nov 6 '10 #2
hpesoj
3
i have 5 subform , when i enter data in subform 1 it should copy data to subform 2 to subform 5. when i write this code it was working fine, but now i get a error message "Run-time error 3021. No current record"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Process_AfterUpdate() 
  2. Dim db As DAO.Database 
  3. Dim rst3 As DAO.Recordset 
  4. Dim rst2 As DAO.Recordset 
  5. Dim rst1 As DAO.Recordset 
  6.  
  7.  
  8. Set rst3 = Forms!frm_BIA!frm_endtoendprcs.Form.RecordsetClone 
  9. Set rst2 = Forms!frm_BIA!frm_prcscrticl_crtria_crtocatybase.Form.RecordsetClone 
  10. Set rst1 = Forms!frm_BIA!frm_SignOff.Form.RecordsetClone 
  11.  
  12. 'find the current record 
  13. 'rst1.FindFirst "ID = " & Me.ID 
  14.  
  15. rst2.MoveLast 
  16. Do While Not rst2.EOF 
  17. If rst2.AbsolutePosition = rst1.AbsolutePosition Then 
  18. rst2.Edit 
  19. rst2!Process = Me.Process 
  20. rst2.Update 
  21. rst3.Edit 
  22. rst3!Process = Me.Process 
  23. rst3.Update 
  24.  
  25. Exit Do 
  26. Else 
  27. rst2.MoveNext 
  28. rst3.MoveNext 
  29.  
  30.  
  31. End If 
  32. Loop 
  33. rst1.Close 
  34. rst2.Close 
  35. rst3.Close 
  36.  
  37. Set rst1 = Nothing 
  38. Set rst1 = Nothing 
  39.  
  40. End Sub
Nov 6 '10 #3
NeoPa
32,556 Expert Mod 16PB
This has got even less explanation in than the first attempt, but I see you've stripped some code out, so I'll take it that you're trying at least.

Now I've added the CODE tags again for you, can you tell me which line (post the number) is highlighted when the error comes up?
Nov 7 '10 #4
NeoPa
32,556 Expert Mod 16PB
Looking at it some more I think maybe your form setup might be a problem. Your references certainly appear to be.

Please do as asked in my post #2 and explain what is going on with your forms. What is a subform of what, and what are the names of the SubForm controls where they are used, and which forms are these controls on?

Remember, it's your job to post the question. If you can't spend the effort to post the information properly then I'm not going to waste much more time on this.
Nov 7 '10 #5
hpesoj
3
To precise it more....

Main form - frm_BIA
Subform - frm_endtoendprcs
Subform - frm_prcscrticl_crtria_crtocatybase
Subform - frm_SignOff

In frm_SignOff I have a field name process, when i enter the process name in Signoff, the process detail should display in other subform frm_endtoendprcs and frm_prcscrticl_crtria_crtocatybase.

when i run the code Afterupdate in frm_SignOff - Process field. i get the error message in "rst2.MoveLast" line.
Nov 7 '10 #6
MMcCarthy
14,534 Expert Mod 8TB
OK in simple terms.

This subform (frm_BIA!frm_prcscrticl_crtria_crtocatybase) does not contain any records.

The only reason you would be getting this error on rs2.MoveLast is if there are no records in this recordset.

You need to figure out why there are no records.
Nov 9 '10 #7
NeoPa
32,556 Expert Mod 16PB
I suppose you are under the impression you have answered the questions asked in my post, yet a quick check shows that subform control names are still missing. There is also no information related to what data is associated with any of your forms. I'm afraid that with that level of care (not even providing the specific info requested, let alone all relevant info), even after being reminded, I'm not interested in spending any more time on this than I already have.

Mary's post is correct of course. That should be enough to start you in the right direction. We could have been so much more help with the information posted though I expect.

Good luck with your project.
Nov 9 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James | last post by:
Hi, I would like to run a custom script on a linux box via a button on a php page (php webpage hosted on the same linux box). Is this possible? If so , can you give me a pointer in the right...
5
by: hakim | last post by:
Hi, I need some information ? How I can run my project (Php) on CGI. Thanks.
2
by: Dica | last post by:
i'm just learning java now, so this might be obvious, but not to me. my app needs to do two things: (1) connect to and fetch a list of tasks for a user from a web service (2) connect to mapquest...
3
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run...
4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
9
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.