Solved

Comparing values from next and previous records

Posted on 1997-10-16
7
193 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
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

Technology Partners: 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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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