Solved

Comparing values from next and previous records

Posted on 1997-10-16
7
192 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 150 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

738 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