?
Solved

Comparing values from next and previous records

Posted on 1997-10-16
7
Medium Priority
?
194 Views
Last Modified: 2006-11-17
null
0
Comment
Question by:kathyearley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
chapie earned 600 total points
ID: 1957388
Right off hand, you're probably seeing this because you don't have an exception if the findfirst doesn't work...you should probably add a line below your rs.FindFirst statement, or probably after the end select, experiment with the location; it should go something like:

if not(rs.NoMatch) then
    if not rs.eof then
    ....
    end if
end if

you could actually speed up the execution of the code by including a with statement, that would replace every instance of your rs.***?? so the above code would look something like

with rs
    if not (.nomatch) then
        if not (.eof) then
...
end with
0
 

Author Comment

by:kathyearley
ID: 1957389
My rs.FindFirst is always working in my case. I tried adding the code you suggested -- all of it and pieces of it -- and it fails every where I put it. As soon as it reaches the rs.MovePrevious (or rs.MoveNext for that matter), it errors out.  Any other suggestions?
0
 

Author Comment

by:kathyearley
ID: 1957390
I just tried it again.  You're right, my FindFirst is never being found.  This is happening, I am assuming since I am entering in a "new" PendIn date and the PendingId is just being generated, but has not yet been saved.  Once I create a record, then edit the PendIn date, my code works fine.  Do you have any suggestions as to how I could still get the current record (unsaved record) to work as the FINDFIRST and then move back to check the previous record? thanks.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:chapie
ID: 1957391
well, I'm kind of confused about what you're after, but if you add a new record, then the previous one would simply be at:
  rs.movelast

something I just saw when re-reading your question is a confusion about the bookmark....I don't know if this aspect covers the whole scope of it's use, but sometimes I'll create a recordsetclone of a form, and want it to contain the whole table, but reside at the same record that the form is currently on, then I'll add the line
rs.bookmark = me.bookmark
which simply says, I want my recordset location (bookmark) to equal the forms recordset

let me know if I didn't completely understand your question about the FINDFIRST and previous record, if I didn't please clearify and I will try to provide a better answer
0
 

Author Comment

by:kathyearley
ID: 1957392
I am probably just confusing you since I'm doing so many different things.  You are helping me immensely.  I figured out that the previous record was at rs.movelast and using that to find my value worked great.  Now my question is this:  when I am entering in a Pending Out date and want to look at the next record and there isn't a next record (since I'm entering a value in the new record), the value of the next record is "empty".  If I say something like: If IsEmpty(vnextvalue) then... even though the value of vNextValue is empty, it doesn't find it.  Can you help me here?  Thanks.
0
 
LVL 3

Expert Comment

by:chapie
ID: 1957393
I've never used or seen IsEmpty referenced before I've always used IsNull(vNextValue) ? questoin: is vNextValue supposed to be the value passed by the NexRecVal() function?

sometimes a variable can be "empty" but not actually be empty, there's a value called "zero length string" which is simply blank (no not a space, like this "") however, the variant object can be null where most other variable types cannot handle nulls, they have to be "", sounds confusing because it is...if you use a null in the wrong variable type you get an error "invalid use of null"

beyond this I'm unclear on what you're asking?
0
 

Author Comment

by:kathyearley
ID: 1957394
Thanks.  You've helped me a great deal even though I confused you.  Thanks so much!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question