Solved

Comparing values from next and previous records

Posted on 1997-10-16
7
188 Views
Last Modified: 2006-11-17
null
0
Comment
Question by:kathyearley
  • 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now