Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Houston, Texas
    Posts
    74

    Unanswered: Save a Field from all records...

    Hi,

    I am almost done. Only last record is being pulled but I want to save all the record in my text box called
    "Me.txtTotalRecipients" ( is a text box on my form to save this)

    Code
    =====================
    Private Sub cmdSaveMail_Click()

    Dim db As DAO.Database
    Dim rst As DAO.Recordset

    Set db = currentdb()
    Set rst = db.OpenRecordset("tbltmpRecipients", dbOpenDynaset)

    rst.MoveFirst
    Recipients = rst.Fields("TotalRecipients")
    rst.MoveNext

    Do While Not rst.EOF
    Recipients = totalrecipients & ", " & rst.Fields("totalrecipients")
    rst.MoveNext
    Loop

    Me.txtTotalRecipients = Recipients

    End Sub

  2. #2
    Join Date
    Dec 2002
    Location
    Houston, Texas
    Posts
    74

    I got it.... yeahhhhhh

    FOLLOWING WORKS LIKE A CHARM. SCOTTN FROM ACCESS-PROGRAMMER.CO.UK HELPED ME.

    THANKS EVERYONE...

    CODE
    ===================
    Private Sub cmdSaveMail_Click()

    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim Recipients as String

    Set db = currentdb()
    Set rst = db.OpenRecordset("tbltmpRecipients", dbOpenDynaset)

    rst.MoveFirst
    Recipients = rst.Fields("TotalRecipients")
    rst.MoveNext

    Do While Not rst.EOF
    Recipients = Recipients & ", " & rst.Fields("totalrecipients")
    rst.MoveNext
    Loop

    Me.txtTotalRecipients = Recipients
    END SUB

Posting Permissions

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