Results 1 to 6 of 6
  1. #1
    mccarthy is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    3

    Smile Query that displays previous row as well

    I have a query that points to a Table. The Table is a link to a text file. I was wondering what statement I should type that displays not only the row my existing query displays but also the previous row. Exmaple my query says report to me anything that has the phrase "permission denied" and it comes back with all the rows with that phrase, however I would also like to see the previous row in the table, associated with this row "permissiond denied".

    I can use auto-number if that makes anythng easier. The columns are:
    Feild 1 Feild 2 Feild 3 Feild 4, "Permission Denied" appears in Feild 3.

    New to Access so please forgive my ignorance.

    Johnny Mac.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    What exactly do you mean by "previous row"? What I'm picturing is that lets say records 1, 7, 15, and 27 contain "permission denied". Do you want your query to return 1, 6, 7, 14, 15, 26, and 27? If so, your table is not set up properly. two records should be related to each other like that. If not, please elaborate on what you mean by "previous row".

  3. #3
    mccarthy is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    3
    You are correct in your presumption. New to Access so when you say, two records should be related to each other like that what do you mean or how does one relate the two records?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    For example, lets take a table of employees. You would hold data on these people. Name, address, phone, email, etc. Each employee would have his or her own record. There should be no significance between employee 3 and employee 4. Perhaps if you elaborate on the contents of the text doc, it would help.

  5. #5
    mccarthy is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    3

    Smile

    Honestly I wish I could provide you an example of the text file but it's on a system that I can not download the files. These are .txt files and each line has log file data that means little to the novice reviewing the file but the only important things is to determine what type of activity occurus on a particular file. My query says look in this table (imported text file) and if you see /var/adm/sulog, let me know and it does. The query reports back the single line but that's not enough. I am forced to investigate futher so I have to performa find in Table for /var/adm/sulog and then mannually go up 6 lines or rows which tells me more on
    path: /var/adm/sulog so I can determine what type of activity occured (read, modify, delete etc). My goals is to take the query which reports when the path is referenced in the table, and also report six rows above. Example below:
    -------------------------------------------------------------------
    unlink
    Erno: 1234 Error 23 UID 25
    Date 2/17/2011
    Source Host: TEST MACHINE
    Destination: 15
    HASH: 5
    path: /var/adm/sulog
    ---------------------------------------------------------------------
    I want the query to report not only path:/var/adm/sulog (which it currenlty does) but the first line that records the word unlink. This text file is huge and has dashes (---) between each recorded activity. The logs are system driven and user driven but always the path is preceded by 6 previous lines with the user or system activity. This is the constant which is why I'm tryng to find a query that can say when you see this path, report also the 6th line above it. Worse case scenro can you provide a query that says when you see this path (/var/adm/sulog) provide all preceeding 6 lines?

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Yea. This is what I was afraid of. The data is being stored incorrectly. Instead of vertically, each record should consist of one line with multiple columns for each piece of info. You would need some means to parse the data into that form. I'm not good at parsing info like this so hopefully someone else can help out.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-10-2011, 11:37 PM
  2. Searching displays
    By FadingAPE in forum Forms
    Replies: 0
    Last Post: 11-04-2010, 03:34 AM
  3. Report displays no records
    By windwardmi in forum Reports
    Replies: 5
    Last Post: 10-05-2010, 12:10 PM
  4. Form displays ID number, not data
    By Twimm in forum Forms
    Replies: 5
    Last Post: 07-13-2010, 03:04 PM
  5. Field displays number instead of value
    By rdueck in forum Reports
    Replies: 6
    Last Post: 02-25-2010, 08:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums