Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    13

    Unanswered: Multiple Records on one line

    Hello all.

    I am working with Access right now.
    I would like to have each record with a specific account number to combine into one long record (same column names repeated for each similar record on one line).

    For example:
    -BEFORE-
    AcctNum: 1, Person: John Doe, DOB: Jan 1, 1977
    AcctNum: 1, Person: Jane Doe, DOB: Jan 1, 1978
    AcctNum: 2, Person: Steve Smith, DOB: Jan 3, 1979

    -AFTER-
    AcctNum: 1, Person: John Doe, DOB: Jan 1, 1977 AcctNum: 1, Person2: Jane Doe, DOB2: Jan 1, 1978
    AcctNum: 2, Person: Steve Smith, DOB: Jan 3, 1979

  2. #2
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    try this

    Function MultipleValues()

    Dim cdb As Database
    Dim rst As Recordset
    Dim strOutput As String

    On Error Resume Next

    strOutput = ""

    Set cdb = CurrentDb
    Set rst = cdb.OpenRecordset("SELECT * FROM [TableName]")

    rst.MoveFirst

    Do Until rst.EOF
    strOutput = strOutput & rst![FieldName] & ";"
    rst.MoveNext
    Loop
    rst.Close
    Set rst = Nothing
    Set cdb = Nothing

    End Function
    "Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •