Results 1 to 5 of 5
  1. #1
    silverxx12 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    18

    IIf Statement

    Hi i have a query output which i have sorted ascending based on the name - so that it looks something like this



    order name amount

    bag bill 1000
    figs bob 2000


    is it possible to create another column which would do the following:

    In the column of name if the current cell had the same name as the one above it then blank the data cell if it was different to equal current cell

    so in excel it would look like IF(B19=B18,"",B19) just not sure how to do this in access ?

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Till some one comes along :
    Say you have :
    order name amount
    bag bill 1000
    sack bill 2000
    figs bob 2000

    If I have understood correctly, is below what you want done in query ?

    order name amount name_1
    bag bill 1000 bill
    sack bill 2000
    figs bob 2000 bob

    If Yes, can I request to know, why?

    Thanks

  3. #3
    silverxx12 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    18
    exactly - i need to output the data in that format ... just do what im told :-s


  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662

    Currently, I can't think of how to do it in a query.
    But, if I am not wrong, these kind of things are handled in Reports along with Grouping ( in this case Group on Name).
    Just, hold on till some one comes along.

    Thanks

  5. #5
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I went through this struggle years ago when I was trying to create a "milage" database to track fuel usage for my vehicles.

    First, read this thread, especially the posts from The Doc Man.
    http://www.access-programmers.co.uk/...d.php?t=130382

    Then see this thread.
    http://www.access-programmers.co.uk/...ad.php?t=27545

    These will give you more info on "Previous Record" in the context of a recordset.
    Post back with questions........


    PS: I had a dateFilledUp field and an Odometer field that I could us (either field) to "Sort" the recordset, assuming I filled up only once in a day per vehicle. You will need a unique field to be able to sort (order) the records.
    Last edited by ssanfu; 05-25-2012 at 07:48 AM. Reason: more thoughts (ouch)

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

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  2. if-then statement in vba
    By rivereridanus in forum Programming
    Replies: 3
    Last Post: 07-07-2011, 02:11 PM
  3. Help with IF statement
    By mkallover in forum Programming
    Replies: 7
    Last Post: 01-04-2011, 04:47 PM
  4. Help with Iif statement
    By tmcrouse in forum Queries
    Replies: 2
    Last Post: 09-02-2010, 09:00 AM
  5. If Then Statement Help
    By Kapelluschsa in forum Programming
    Replies: 5
    Last Post: 08-11-2010, 09:24 AM

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