473,385 Members | 1,492 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,385 software developers and data experts.

Run - Time Error 3021 "No Current Record"

Hello Again.

I have been proceeding through my code, thanks to you guys, and although this particular line may not be needed it is giving me this error that does not make sense.

When asked to print a msgbox with the content of a particular field after inserting and updating a new record it states that there is not current Record.

Could anyone explain or tell me what I'm doing wrong?

Thank you,

You may not know it but you guys have made my New Years!!
Dec 29 '10 #1
2 3660
Sorry Code is Below:

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Dim JMP As String 'Jobs Main Positions
  3.     Dim EMP As String 'Employee Main Positions under NotAbsent
  4.  
  5.     While Not Jobs.EOF
  6.         JMP = Jobs![Main Positions]
  7.         MsgBox "JMP: " & JMP
  8.  
  9.         While Not NotAbsent.EOF
  10.             EMP = NotAbsent![Main Positions]
  11.             MsgBox "EMP: " & EMP
  12.  
  13.             If EMP = JMP Then
  14.  
  15.                 Schedule.AddNew
  16.                 Schedule![First Name] = NotAbsent![First Name]
  17.                 Schedule![Last Name] = NotAbsent![Last Name]
  18.                 Schedule![Main Positions] = NotAbsent![Main Positions]
  19.                 'Schedule![Replacement Positions] = NotAbsent![Replacement Positions]
  20.  
  21.                 Schedule.Update
  22.                 MsgBox "Schedule: " & Schedule![First Name]
  23.  
  24.  
  25.             End If
  26.  
  27.             NotAbsent.MoveNext
  28.         Wend
  29.  
  30.         Jobs.MoveNext
  31.     Wend
  32.  
  33.  
  34.  
Also you may see one line of code that is commended out; I have this error that states "Item Not Found In This Collection" 3265. The line before it have all been copied and pasted and only the content in the [] would be provoking the error. After checking spelling error and finding nothing wrong, I'm not sure what it could be.

Thank you again!
Dec 29 '10 #2
Stewart Ross
2,545 Expert Mod 2GB
Hi. You'll need to do some line-by-line walk throughs of your code to see what is going on. Set a break point at, say, the IF statement in line 13 and then single-step through the code looking at the values of all fields to see what is going wrong.

I'd surmise that if all is working OK until line 21 - the update statement - then the update itself failed. This can happen if you have attempted to insert a record that breaks a relational constraint on the table concerned, or that would create a duplicate key for example.

Regarding the 'item not found in this collection' error, this is telling you that the field name concerned ([Replacement Positions]) is not correct - either the field does not exist in one or both of the two recordsets, or it is spelled differently. Why the error message mentions 'collection' is that when using recordsets the VB compiler is iterating through the fields collection of the recordset to match the names of the fields as you have listed them; if it can't find a match it generates the error you have mentioned.

For a more detailed guide on how to use the VBA editor's debugging facilities please see our articles on Debugging in VBA.

-Stewart
Dec 31 '10 #3

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

Similar topics

0
by: Charles Law | last post by:
I have started getting "There is no source code available for the current location" when I run my VB.NET solution. I have no breakpoints set but cannot get rid of this message. The debugger...
0
by: Stan | last post by:
Ocasionally I get this error message: "A severe error occurred on the current command. The results, if any, should be discarded" There is an arcticle in MSDN describing this problem, but it...
0
by: Raquel | last post by:
Have installed UDB PE V8.0 on Win XP and wrote a JDBC program using driver com.ibm.db2.jcc.DB2Driver. At run time, it throws error "No Suitable Driver". Why is it? When I use JDBC-ODBC bridge...
4
by: amywolfie | last post by:
I would like to put code behind a Find button on a form which: 1) Performs a find based on a field on the form 2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message box. ...
0
by: feng | last post by:
Hi, I am having a strange problem right now and I don't even know how to go about it. Someone please help me! Any inputs will be highly appreciated. We have an application that has a VB.Net...
3
by: domcatanzarite | last post by:
How would one create a button that on click advances the form to the next "non recurring record" as opposed to the next record. The field the button needs to que from has groups of duplicate...
1
by: vincentt via AccessMonster.com | last post by:
Hi all, I have a multi-table query, link to the following table: order table client info table receipt table discount card table I want to query multiple fields in the above table....
11
by: CrostonScottish | last post by:
Can anybody help? I have this code i have put together so that when i select values for my combo boxes which are linked to values in lookup tables, it opens my "frmriskass" with only the...
1
by: indikamaligaspe | last post by:
Hi all, I am trying to get a PL/TCL trigger to update an audit table working. The problem is when I create the trigger on an exiting table, I get the following error "ERROR: can't read...
1
by: mitica grigore | last post by:
hello i use an access 2002-2003 database under an access 2007 environment and win xp sp3 i have about 24'000 records so far sometimes, when i try to use "back-up database" or "compact & repair...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.