Results 1 to 2 of 2
  1. #1
    wasim_sono is offline Advanced Beginner
    Windows XP Access 2013 64bit
    Join Date
    May 2005
    Location
    Pakistan
    Posts
    73

    Customized Format for displaying record

    Dear All



    I need to develope a summary report. For This want to display the records in one line.

    For example I have fileds 'Bill No', 'Emp Name'and 'Amount'.
    The data for this is as under

    002 ABC 2450
    003 CBA 1560
    004 ABC 623
    005 CBA 952
    006 ABD 425

    the report format may look like

    EMP NAME Bill No Total Bill Amount

    ABC 002,004 2 3073
    CBA 003,005 2 2512
    ABD 006 1 425

    I need to knoe that how to display bill no in a row?

    Thanks.

    Wasim

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Wasim,

    Add this function to a regular module:


    Code:
    Function ConcatFieldVals(TblName As String, ConcatField As String, GroupField As String, GroupVal)
    
        Dim rs As DAO.Recordset
        Dim Result As String
        
        Set rs = CurrentDb.OpenRecordset("SELECT [" & ConcatField & "] AS Concat " & _
            "FROM [" & TblName & "] " & _
            "WHERE [" & GroupField & "] = '" & GroupVal & "'")
            
        With rs
            .MoveFirst
            Do Until .EOF
                Result = Result & "," & !Concat
                .MoveNext
            Loop
            .Close
        End With
        
        ConcatFieldVals = Mid(Result, 2)
        
        Set rs = Nothing
        
    End Function


    Then run a query like this:

    SELECT EmpName, ConcatFieldVals("tbl","BillNo","EmpName",[EmpName]) AS Bill, Count(Amount) AS CountOfAmount, Sum(Amount) AS SumOfAmount
    FROM tbl
    GROUP BY EmpName, ConcatFieldVals("tbl","BillNo","EmpName",[EmpName]);

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

Similar Threads

  1. Text Box Format
    By Scott in forum Forms
    Replies: 0
    Last Post: 01-09-2008, 11:13 PM
  2. Date Format
    By wasim_sono in forum Forms
    Replies: 2
    Last Post: 08-15-2006, 01:20 AM
  3. Conditional Format Query
    By Schwagr in forum Queries
    Replies: 3
    Last Post: 03-20-2006, 02:39 PM
  4. Date Format
    By St3ph3n in forum Access
    Replies: 4
    Last Post: 03-09-2006, 11:23 AM
  5. How to format text in a report
    By Kimelco in forum Access
    Replies: 1
    Last Post: 01-06-2006, 07:30 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