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

Error On Next Record If Already open..

7
Hello Ladies/Gents, im in need of some serious help here.. I have a tool that allows users to view information on a form and make changes to recordsets. This tool has buttons that allow a user to cruise to the next or previous record. The problem i am having is when they click next record it moves to the next record and checks to see if the record is stamped as open. If it is stamped as open, meaning opened by another user, then it will continue to proceed to the next record until it reaches a record not already stamped open. I will post the code below Im using for next the previous is the same except for it moves previous. When they click next or previous even though they are not changing any information, just checking to see if the record is open, the user who was looking at that record gets an error when trying to click next record. Its an error relating to the row was modified outside of cursor. My question is how am I supposed to allow them to proceed through records without getting this error? They are not modifying the record just looking to see if its stamped open.
thanks for your help.

Expand|Select|Wrap|Line Numbers
  1.  
  2. redoLoop:
  3.     If Not rs.EOF Then
  4.         rs.Fields("current User ID") = ""
  5.         rs.Update
  6.        rs.MoveNext
  7.         curRecord = curRecord + 1
  8.         If rs.EOF Then
  9.             rs.MovePrevious
  10.             curRecord = curRecord - 1
  11.             If utreview = "Y" Then
  12.                MsgBox ("You have reached the end of the review.")
  13.                 Unload Me
  14.                 utreview = ""
  15.                 Exit Sub
  16.             End If
  17.         End If
  18.  
  19.         If typeReview = "IA" Then
  20.             If rs.Fields("current user id") <> "" Or rs.Fields("IA Review Date") <> "1/1/1900" Then GoTo redoLoop
  21.         ElseIf utreview = "Y" Then
  22.  
  23.         Else
  24.             If rs.Fields("current user id") <> "" Or rs.Fields("UT Date") <> "1/1/1900" Then GoTo redoLoop
  25.         End If
  26.  
  27.     End If
  28.     popRecord
  29.     Exit Sub
  30.  
Feb 22 '08 #1
1 1785
VBWheaties
145 100+
Hello Ladies/Gents, im in need of some serious help here.. I have a tool that allows users to view information on a form and make changes to recordsets. This tool has buttons that allow a user to cruise to the next or previous record. The problem i am having is when they click next record it moves to the next record and checks to see if the record is stamped as open. If it is stamped as open, meaning opened by another user, then it will continue to proceed to the next record until it reaches a record not already stamped open. I will post the code below Im using for next the previous is the same except for it moves previous. When they click next or previous even though they are not changing any information, just checking to see if the record is open, the user who was looking at that record gets an error when trying to click next record. Its an error relating to the row was modified outside of cursor. My question is how am I supposed to allow them to proceed through records without getting this error? They are not modifying the record just looking to see if its stamped open.
thanks for your help.

Expand|Select|Wrap|Line Numbers
  1.  
  2. redoLoop:
  3.     If Not rs.EOF Then
  4.         rs.Fields("current User ID") = ""
  5.         rs.Update
  6.        rs.MoveNext
  7.         curRecord = curRecord + 1
  8.         If rs.EOF Then
  9.             rs.MovePrevious
  10.             curRecord = curRecord - 1
  11.             If utreview = "Y" Then
  12.                MsgBox ("You have reached the end of the review.")
  13.                 Unload Me
  14.                 utreview = ""
  15.                 Exit Sub
  16.             End If
  17.         End If
  18.  
  19.         If typeReview = "IA" Then
  20.             If rs.Fields("current user id") <> "" Or rs.Fields("IA Review Date") <> "1/1/1900" Then GoTo redoLoop
  21.         ElseIf utreview = "Y" Then
  22.  
  23.         Else
  24.             If rs.Fields("current user id") <> "" Or rs.Fields("UT Date") <> "1/1/1900" Then GoTo redoLoop
  25.         End If
  26.  
  27.     End If
  28.     popRecord
  29.     Exit Sub
  30.  
One constructive critique: GoTo statements make code unreadable or difficult to debug.

You can use .SUPPORTS to see if the various operations needed are allowed. This will then tell you what you should do to correct your problem.

For example, let's say you are going to MovePrevious, rs.Supports(adMovePrevious) must return TRUE in order to move.
Now, lets say you want to Update. rs.Supports(adUpdate) needs to return True.
Wherever you are getting your error, you should place Supports before doing it.

Supports method:
http://www.w3schools.com/ado/met_rs_supports.asp

Now, lets say you cant move or update. This is where the LockType and CursorType properties become relevent. Based on what you are not allowed to do, you will have to adjust your locktype and cursortype properties before opening the recordset in order to be able to do it.

Locktype:
http://www.w3schools.com/ado/prop_rs_locktype.asp

CursorType:
http://www.w3schools.com/ado/prop_rs_cursortype.asp
Feb 22 '08 #2

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

Similar topics

8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
25
by: abbylee26 | last post by:
my page works fine if the db search finds at least one record that satifies the query. but if it does not find a match I get the following error message. Error Type: ADODB.Field (0x80020009)...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
4
by: Abdhul Saleem | last post by:
Hi, I am recieving error ActiveX component can't create object in the following line in the asp page. set ExcelApp = CreateObject("Excel.Application") Previously this code was working fine....
6
by: dragiton | last post by:
ASP Code Redirect Error Hello I recently relaunched a website containing asp code which used to work perfectly. However, after resetting up the SQL DB and trying to work out some site bugs I have...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
2
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.