Results 1 to 3 of 3

Thread: Sending Message

  1. #1
    Join Date
    Jun 2002

    Unanswered: Sending Message

    I have an application in Access 97. When a user inserts a record in a table I have to send a message to another user (in the LAN) to tell him to check the table's new data. How can I do that?
    Can anybody help me?


  2. #2
    Join Date
    Sep 2002


    I had to do something very similar for an equipment database that was receiving work order requests by employees. I used a sendobject macro to email a report via outlook in RTF/Word format.

    Create a select query that uses the "Last" aggregate option for the Total Row. SQL statement would simlar to:

    SELECT Last(tablename.fieldname) AS LastOffieldname,

    repeat this for each field

    THis would select the last Record based on the fields you selected. In my case my query selects the last work order that has the status of "request" (default value for this field).

    Create a report from this query with the format you desire.

    Create a macro using the sendobject command. and attach the macro to the "After Insert" Event for the form being used to enter data. I also included "MsgBox" popup in the macro that thanks them for their submission.

    Its nothing fancy but it works. Ive run into some issues with the sendobject permission and outlook not being open (it prompts for a user profile), but this seems to have fixed itself somehow (dont ask me).

    Of course you have to be using outlook as your email client for this to work.

    Hope this helps.


  3. #3
    Join Date
    Jul 2002
    Use the AfterInsert event of the form (you can paste this code):

    Private Sub Form_AfterInsert()
    Dim Mesaj As String
    Dim fld As Field
    'set the recordset cursor to form cursor to position it on the last record

    Me.RecordsetClone.Bookmark = Me.Bookmark
    'Loop through the Fields collection

    For Each fld In Me.RecordsetClone.Fields
    Mesaj = Mesaj & fld.Name & ": " & fld.Value & vbCrLf

    DoCmd.SendObject , , , "", , , "Subiect: Inregistrare noua!", Mesaj, False

    End Sub

    This will populate the email body with the field names and values for the newly inserted record. And SendObject works for virtually any default email client installed on the system. I tried Outlook, Outlook Express, Netscape Messenger and it worked fine.

    Good luck

    Dan from Slatina

Posting Permissions

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