Use value from previous field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm wondering if a query can use the value from the previous record if the
field meets a certain critera. I was thinking this would be possible in an
If statement but I don't know what the command would be. For example:
IIF(right([acct no],5)="*OPP1",use previous record,"114")

In this example, if the last 5 digit in the account number equls "*OPP1",
then use the vaule from previous record. If not use "114". Is this at all
possible?
 
I'm wondering if a query can use the value from the previous record if the
field meets a certain critera. I was thinking this would be possible in an
If statement but I don't know what the command would be. For example:
IIF(right([acct no],5)="*OPP1",use previous record,"114")

In this example, if the last 5 digit in the account number equls "*OPP1",
then use the vaule from previous record. If not use "114". Is this at all
possible?

It sounds like you've got some design problems! A field in a table
should depend on that table's Primary Key, and not on other fields in
the table nor on other records in the table.

Bear in mind that "the previous record" is a meaningless expression in
a Table; tables HAVE no definable order.

What's the context? Is this in the course of data entry? If so, I
presume you're using a Form; you could use the AfterUpdate event of
the [acct no] field and use DLookUp to find the value from the
previous record, or there may be other approaches.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top