Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2004
    Posts
    85

    Unanswered: pwease help me..

    i have a form when the user fills it out it stores in into a table, then i email it to a reciepent from a command button

    but the major problem is that the command button i use on the form produces the whole table. i want it to only include the recent additions. for example i want to email the new records only. any ideas

    also i email a report, and again it will email all records, not just the new records which what i want


    can you please give me some idea's.. im not that very good with coding. im a Wizard girl

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

    if you have a date field in your table, you could run a query of entries for the specific date and then send that info

  3. #3
    Join Date
    Apr 2004
    Posts
    85
    Yes i just did that. also can i do it by Date and Time?

  4. #4
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    you certainly can as long as you have date and time fields in your table

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ...or you could add a yes/no field to your table. default FALSE, switch to TRUE when the record has been mailed (?? and switch back to FALSE if the record is edited later ??)

    one query to select, one query to update.

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Apr 2004
    Posts
    85
    okay.. True or false thing sounds good
    although i dont think ill have to change back after update
    i have a yes / box default is no
    now what?
    im lost

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    make a saved query (search criteria is your yes/no = FALSE) on the table you are currently mailing

    then you need another query, same table, menu:Query/Update and you update the FALSE to TRUE

    use whatever is currently sending your table to
    ...send the query return (instead of the table)
    ...run the update query

    done!


    if you need this step-by-step, post the code you are currently using to mail the table, the name of the table, the name of the yes/no.

    izy
    currently using SS 2008R2

  8. #8
    Join Date
    Apr 2004
    Posts
    85
    Table Name = Table1
    yes/no box = Emailed

    Private Sub report_Click()
    On Error GoTo Err_report_Click

    Dim stDocName As String

    stDocName = "dailyreport"
    DoCmd.SendObject acReport, stDocName, acFormatRTF

    Exit_report_Click:
    Exit Sub

    Err_report_Click:
    MsgBox Err.Description
    Resume Exit_report_Click

    End Sub

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    query, new, switch to SQL view (top left)
    copy/paste the following:
    SELECT * FROM table1 WHERE Emailed = False;
    save ...name is SelectStuff

    query, new, switch to SQL view
    copy/paste the following:
    UPDATE table1 SET table1.Emailed = True;

    or (a matter of taste and experimentation to see which runs fastest)
    UPDATE table1 SET table1.Emailed = True WHERE table1.Emailed = False;

    save ...name is UpdateStuff

    i'm guessing now that "dailyReport" is based on table "table1"....

    copy your report "dailyReport" to "cDailyReport"
    open "cDailyReport" in design view:
    properties/data/recordsource ...and use the combo to set the SelectStuff query

    open your form in design view, Alt-F11 for the code window: edit your existing code to read:

    Private Sub report_Click()
    On Error GoTo Err_report_Click

    Dim stDocName As String

    stDocName = "cDailyRport"
    DoCmd.SendObject acReport, stDocName, acFormatRTF
    docmd.setwarnings false
    docmd.openquery "UpdateStuff"
    docmd.setwarnings true


    Exit_report_Click:
    Exit Sub

    Err_report_Click:
    MsgBox Err.Description
    Resume Exit_report_Click

    End Sub


    izy
    Last edited by izyrider; 06-25-04 at 11:06.
    currently using SS 2008R2

Posting Permissions

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