Results 1 to 7 of 7
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Combine same IDs in report but with Different Values


    Hello, is it possible to combine rows with same channel ID's but with different values? for ex: in pic, you see the ID B0175 with 11 rows. is it possible to make this ONE row, but retain the values from all eleven rows and put them in one line? so it would display a "1" in whatever month it belongs to
    Attached Thumbnails Attached Thumbnails rptpic.JPG  

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Is that how the table is structured? That is not normalized. Try an aggregate query with GROUP BY on ChannelID and Sum or Last aggregate function under each of the date fields.
    Last edited by June7; 02-24-2012 at 08:45 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    what do you mean by normalized? thanks

  4. #4
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    "Last" looks like it only takes the last value and not all, "Sum" does not work, says that jetdatabase could not read data type, which im assuming is reading my "1" values as string. However, my months are constructed like this: Jan '11: IIf([Month]="January, 2011",Val("1"),"") shouldnt this convert the string to a "Number value"?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    But there is an empty string if the condition is not met. Can't Sum empty string. Try this expression: Jan '11: IIf([Month]="January, 2011",1,Null). Can Sum with Nulls. Actually, I should have suggested Max. Show the complete SQL statement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    ahh it works!!! thanks Jun, you're the best. Heres my sql if interested:

    SELECT qryHHFRequestsSKYTEL_ABS.[Channel ID], Sum(IIf([Month]="January, 2011",Val("1"),Null)) AS [Jan '11], Sum(IIf([Month]="February, 2011",Val("1"),Null)) AS [Feb '11], Sum(IIf([Month]="March, 2011",Val("1"),Null)) AS [Mar '11], Sum(IIf([Month]="April, 2011",Val("1"),Null)) AS [Apr '11], Sum(IIf([Month]="May, 2011",Val("1"),Null)) AS [May '11], Sum(IIf([Month]="June",Val("1"),Null)) AS [Jun '11], Sum(IIf([Month]="July, 2011",Val("1"),Null)) AS [Jul '11], Sum(IIf([Month]="August, 2011",Val("1"),Null)) AS [Aug '11], Sum(IIf([Month]="September, 2011",Val("1"),Null)) AS [Sep '11], Sum(IIf([Month]="October, 2011",Val("1"),Null)) AS [Oct '11], Sum(IIf([Month]="November, 2011",Val("1"),Null)) AS [Nov '11], Sum(IIf([Month]="December, 2011",Val("1"),Null)) AS [Dec '11], Sum(IIf([Month]="January, 2012",Val("1"),Null)) AS [Jan '12]
    FROM qryHHFRequestsSKYTEL_ABS
    GROUP BY qryHHFRequestsSKYTEL_ABS.[Channel ID]
    ORDER BY qryHHFRequestsSKYTEL_ABS.[Channel ID];

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Use of Val function is unnecessary processing in the function, don't need it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 4
    Last Post: 10-28-2011, 12:49 PM
  2. Combine values from multiple fields
    By jsimard in forum Queries
    Replies: 8
    Last Post: 06-09-2011, 01:05 PM
  3. Can we combine 3 queries on 1 report? :?
    By radicrains in forum Queries
    Replies: 3
    Last Post: 10-28-2010, 09:35 PM
  4. Combine the values of two fields on a form
    By nyteowl in forum Access
    Replies: 4
    Last Post: 10-15-2010, 11:16 AM
  5. Combine First and Last name fields for Report
    By yes sir in forum Reports
    Replies: 32
    Last Post: 08-31-2010, 07:31 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