473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Previous Work Center

Hello,

I have Data that looks like this:

Order.....Operation.....Work Center
1....................10....................1234
1....................20....................5678
1....................30....................9123

What I am trying to do is create a column that returns the previous work center. For example on Operation 30 I'd like this column to return 5678. Thanks in advance for your help.
Nov 8 '07 #1
1 1108
Lysander
344 Expert 100+
Hello,

I have Data that looks like this:

Order.....Operation.....Work Center
1....................10....................1234
1....................20....................5678
1....................30....................9123

What I am trying to do is create a column that returns the previous work center. For example on Operation 30 I'd like this column to return 5678. Thanks in advance for your help.
Okay, I assume that Operation is in ascending order,and unique.

I have a table that lists village id, name, and enum id.
Village_id.......Name..........Enum_id
001...............ThisTown......234
002...............ThatTown.....354
003...............Mytown........898

The sql query to get this is simply
Expand|Select|Wrap|Line Numbers
  1. SELECT tblVillage.Village_Id, tblVillage.VillageName, tblVillage.Enumerator_Id
  2. FROM tblVillage;
  3.  
  4.  
I know need to add a column to refer to the previous village
This code is LastVill: DMax("Village_id","tblVillage","Village_id<" & [village_id])

and the SQL looks like this
Expand|Select|Wrap|Line Numbers
  1. SELECT tblVillage.Village_Id, tblVillage.VillageName, tblVillage.Enumerator_Id, DMax("Village_id","tblVillage","Village_id<" & [village_id]) AS LastVill
  2. FROM tblVillage;
  3.  
  4.  
Now I can use LastVill to get the enumerator I want as follows
LastEnum: DLookUp("Enumerator_ID","tblVillage","Village_ID=" & [LastVill])
and the SQL looks like this
Expand|Select|Wrap|Line Numbers
  1. SELECT tblVillage.Village_Id, tblVillage.VillageName, tblVillage.Enumerator_Id, DMax("Village_id","tblVillage","Village_id<" & [village_id]) AS LastVill, DLookUp("Enumerator_ID","tblVillage","Village_ID=" & [LastVill]) AS LastEnum
  2. FROM tblVillage;
  3.  
  4.  

and I end up with

Village_id.......Name.........Enum_id...LastVill.. ...LastEnum
001...............ThisTown......234............... ..........#error#
002...............ThatTown.....354...........001.. ........234
003...............Mytown.......898...........002.. ........354
Nov 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: ITAutobot25 | last post by:
Now this is really the last problem (for real now) with this assignment. My sorter is not working. I managed to sort by product name in my previous assignment; however, I can't get it to work on this...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.