Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    15

    Unanswered: String made from unique records in a recordset

    I need to generate a string based on unique values in a recordset. This text string is going to be used on a report to list which departments are being represented in the results of a report. I have created a subform who's recordset is created from a select distinct sql statement, the recordset only includes a single colum and a record for each individual department. How can I list the all of the records on a single text line?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you have a form displaying the desired recordset....

    dim longString as string
    dim recs as recordset
    set recs = me.recordsetclone
    with recs
    .movefirst
    do while not .eof()
    longString = longString & !whateverIsYourFieldName
    'or if you want a separator between fields
    'longString = longString & !whateverIsYourFieldName & " "
    .movenext
    loop
    end with
    myTextBox.value = longString

    ...or did i misunderstand your question?

    izy

  3. #3
    Join Date
    Jan 2003
    Posts
    15
    I think so, but I need to be able to use this string on a report

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if your form is open during the reporting, you can declare
    public longString as string
    at the top of the form code and collect it or collect
    forms!yourformName.myTextBox.value

    else declare longString global in a module

    or try similar code in a report event if the report is bound

    izy

Posting Permissions

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