Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    karoly is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5

    how to avoid duplicate column values in access reports?

    I have a report which has say two columns - staff number and visit date.
    For a staff number (which is unique) there may be more than one visit date. But I want to list a staff number only once and not multiple times in the column (but want all the visit dates of course). How can I do that?

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Setup grouping (ie. sorting/grouping popup) within the main report so it groups on staff number (putting staff number in the grouping section) and then the visit dates in the detail section.

    Or have your main report based uniquely on the staff number and have a sub-report within that report based on the visit dates (linking to the main report by staff number).

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would think simply setting the HideDuplicates property of the control to YES would achieve the results desired. It is on the Format tab of the property sheet of each control.

  4. #4
    karoly is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5

    Thanks RuralGuy

    Can you answer one more question?

    I want to count the number of records in each group (that is number of records with a duplicate field ) and display it in a third field. How can I do that?

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can put an invisible TextBox in the detail section with the ControlSource set to =1 and Sum Over the Group.

  6. #6
    SteveH2508 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    Quote Originally Posted by karoly View Post
    Can you answer one more question?

    I want to count the number of records in each group (that is number of records with a duplicate field ) and display it in a third field. How can I do that?
    Put a textbox in the group footer with the controlsource =Count(*)

  7. #7
    karoly is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    Quote Originally Posted by RuralGuy View Post
    You can put an invisible TextBox in the detail section with the ControlSource set to =1 and Sum Over the Group.
    Thanks Rural Guy

    But how to sum over the group? Do you mean to make a group footer?(which will but cause the count to come in a separate row which i dont prefer). Even For that what is the need for invisible tex tbox, as count(*) will do right? Without group footer how to specify a group?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Sum is one of the properties on the Data tab of the control.

  9. #9
    karoly is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    Quote Originally Posted by RuralGuy View Post
    Sum is one of the properties on the Data tab of the control.
    Is there a way I can avoid duplicate values in a field across groups (not in a single group, which I can do by using the property Hide duplicates)?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You lost me there. If you have grouped on a field then *all* of those values will be together, not scattered in several groups.

  11. #11
    tarhim47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    57

    How to hide the blanks?

    Quote Originally Posted by RuralGuy View Post
    I would think simply setting the HideDuplicates property of the control to YES would achieve the results desired. It is on the Format tab of the property sheet of each control.
    I tried this and it works great. It hides all the duplicate values. However it leaves a blank space where the duplicate would otherwise be placed. For example, if I have for "John"s in my table, the report shows only one John however leaves three blank spaces bfore showing "Ken."

    How can I fix this?

    Thanks for yuor help!

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about showing us what you would like the report to look like with some sample dummy data typed in. The "blank" spaces are probably additional records.

  13. #13
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    When 'Hide Duplicate' Property value is set to Yes the text box itself will disappear, till the field value changes. If you need it replaced with an empty rectangle then you should draw a rectangle of the same size and place it behind the textbox. This will fill the empty space with a box of the same size of text box and the report will look better. I used to do this trick.

    Or

    I used to draw a vertical line in the detail Section and align it at the left border of the text box, if it is the left-most field, and this will draw a left vertical border rather than leaving it open at the left side.

  14. #14
    tarhim47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    57
    Hi RuralGuy,

    I apologize for not replying earlier but I have since figured out the problem.

    Thanks for all your help!

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for posting back.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Avoid column deletion in datasheet
    By dinorbaccess in forum Forms
    Replies: 6
    Last Post: 12-29-2010, 03:08 PM
  2. Assigning values to duplicate records
    By matteu1 in forum Queries
    Replies: 3
    Last Post: 02-17-2010, 10:35 PM
  3. Duplicate Values in table
    By senthilrg in forum Queries
    Replies: 3
    Last Post: 12-18-2009, 09:24 PM
  4. Replies: 1
    Last Post: 08-21-2009, 06:52 AM
  5. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05:23 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