DoCmd Code

I'm wanting to insert data, in this case and employee's name from query1, 
into the text of an email.  Can anyone tell me how this is done.  I've 
provide some sample code below.  Many thanks!

Function SendEmail()

DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , "Adherence", _
"The following agent (Query1.[Employee Name]) is out of adherence"

End Function

0
Utf
1/23/2008 2:26:02 PM
access 16762 articles. 3 followers. Follow

2 Replies
833 Views

Similar Articles

[PageSpeed] 56

you can use DLookup() but there may be a better way depending on how you are 
running this code.  For example, how are you deriving the "John Doe" name?

DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , "Adherence", 
_
 "The following agent  & " DLookup("[Employee Name]", "Query1", "some where 
string that resolves to a single record") & " is out of adherence"

BTW - change your query names to something meaningful.  Don't leave them as 
the default names.

"Stan" <Stan@discussions.microsoft.com> wrote in message 
news:9FF4F860-4F4C-4A51-83CC-D04227C1A111@microsoft.com...
> I'm wanting to insert data, in this case and employee's name from query1,
> into the text of an email.  Can anyone tell me how this is done.  I've
> provide some sample code below.  Many thanks!
>
> Function SendEmail()
>
> DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , 
> "Adherence", _
> "The following agent (Query1.[Employee Name]) is out of adherence"
>
> End Function
> 


0
Pat
1/23/2008 4:07:29 PM
Many thanks Pat.  That worked.

"Pat Hartman" wrote:

> you can use DLookup() but there may be a better way depending on how you are 
> running this code.  For example, how are you deriving the "John Doe" name?
> 
> DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , "Adherence", 
> _
>  "The following agent  & " DLookup("[Employee Name]", "Query1", "some where 
> string that resolves to a single record") & " is out of adherence"
> 
> BTW - change your query names to something meaningful.  Don't leave them as 
> the default names.
> 
> "Stan" <Stan@discussions.microsoft.com> wrote in message 
> news:9FF4F860-4F4C-4A51-83CC-D04227C1A111@microsoft.com...
> > I'm wanting to insert data, in this case and employee's name from query1,
> > into the text of an email.  Can anyone tell me how this is done.  I've
> > provide some sample code below.  Many thanks!
> >
> > Function SendEmail()
> >
> > DoCmd.SendObject acSendQuery, "Query1", "HTML", "John Doe", , , 
> > "Adherence", _
> > "The following agent (Query1.[Employee Name]) is out of adherence"
> >
> > End Function
> > 
> 
> 
> 
0
Utf
1/23/2008 7:20:03 PM
Reply:

Similar Artilces:

Synchronizing Combo Boxes Code
tblObservation Category CategoryID Observation Category tblObservation Questions QuestionID Question Number Question Name CategoryID 1st question - In the Observation Questions I want to combine the Question Number with the Question Name in the table. 2nd question - In a form when I select the Question Number/Name I want the Observation Category to sync. Example: Observation Category Observation Category = Personal Safety Observation Questions Question Number = 01 Question Name = Hard Hats When select "01" populates with "Hard Hats&quo...

Macro code for END + Arrow key movement
When recording a macro - the absolute cell addresses are referenced as an end result of my using the END & UPARROW (DOWN ARROW, etc...). In an unknown range of data I would like to use the movement keys define my print range. My method is to go to column D - press the END + DOWN ARROW which moves me to the last used cell in column D. Hold the Shift key and press CTRL HOME - which moves me back to B2 (due to frozen titles) - then I press the UP ARROW and next the LEFT ARROW KEY ( to include row 1 and column A). Then set the print range. Can someone advise as to macro code for this proce...

A New Error code 646
I have Windows 7 and on 4/17/10 I just started getting error code 646 when trying to install updates KB980729 (MS Office OneNote 2007) and KB981715 (2007 Microsoft Office System). I also have problelms fixng Adobe since I get the message that he latest update is not compatible with 64 Bit. Tried uninstalling and reinstalling earlier version but can't quite get it done. Any suggestions would be appreciated. -- Debi C. Debi wrote: > I have Windows 7 and on 4/17/10 I just started getting error code > 646 when trying to install updates KB980729 (MS Office OneNote &g...

Help with Code
Hi All, I am having the following code which stpos after copying data from the first instance of the sheet. How cud i fix this problem? Sub CurMonth() Sheets("CasCrd").Select Rows("2:2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Shift:=xlUp Range("A1").Select Sheets("Interface").Select For Each Sh In Sheets Sh.Select If Mid(Sh.Name, 2, 2) = Right(Sheets("Interface").[C2], 2) Then Range("A1").Select Selection.AutoFilter Field:=4, Criteria1:="N" Selection....

How to set area code in Outlook 2003
Any time I started up previous version of outlook and started to enter a phone number it would prompt me to input my local area code and from then on it would put it in for me when i typed 7 digit phone number. I just started 2003 and it never asked...noor seems to care. If I enter a 7 digit phone number it just leaves it that way. Any way of telling it where I live and telling it to enter area code automatically...like the old days? Thanks Your dialing location in Control Panel > Phones and Modems... -- Russ Valentine [MVP-Outlook] "Wekiva" <no@email.com> wrote in ...

FREE GODADDY COUPON CODES
FreshDrop.net has been helping the domain community so much from offering our data services for free. We want to continue to help the domain community grow and as such we feel that it is very appropriate to help community members by letting them know how they can save on their GoDaddy renewals and registrations. This is less about FreshDrop and more about helping each other out to grow. With that in mind, here are yet even more GoDaddy coupon codes where everyone can use to get savings. cjc695dom . . . . . $6.95 COM Renewals and Registrations cjcsave10 . . . . . Receive 10% off al...

Visio 2003 Sample Code
Hi I am desperatly looking for sample code or Tutorial for developing Visio 2003 in C# Since the Visio 2003 SDK has yet to be released, the Visio 2002 SDK can be used for the basics. (Hidden somewhere on the MS website) John... Visio MVP Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm Need VBA examples? http://www.mvps.org/visio/VBA.htm Common Visio Questions http://www.mvps.org/visio/common_questions.htm "Roni" <ronip@ectel.com> wrote in message news:uFAd5h%23tDHA.2132@TK2MSFTNGP10.phx.gbl... > Hi > > I am desperatly looking for sample code o...

Requested mail action aborted: exceeded storage allocation. [SMTP Error Code 552]
Hey guys, One of my users is getting this error returned to him when he is sending large email attachments to an external domain. He can send text emails successfully. Here are some facts about the network. - Windows 2k3 with Exchange 2003 -McAfee Webshield (SmartHost) -Firebox X700 Firewall He is not exceeding outgoing SMTP size limits. The internal and external domain's inbox's are NOT full. Any ideas? 552 is a general SMTP protocol error and MS documented a situation where this was caused by low disk space or low memory. Check your server. Nue "djw" <djw_1@ya...

asmx without code behind
Hi, I was just wondering: is it possible to write an asmx webservice in .NET 2.0 without having a code behind file? So just a xxx.amx file and no xxx.amx.cs file, and as a consequence no dll's... If so, anyone can give an example of that, for example an HelloWorld? Veerle On 2 mrt, 14:08, Veerle <veerleve...@hotmail.com> wrote: > Hi, > > I was just wondering: is it possible to write an asmx webservice > in .NET 2.0 without having a code behind file? > So just a xxx.amx file and no xxx.amx.cs file, and as a consequence no > dll's... > If so,...

How convert Docmd.Domenuitem
I'm converting a 97 db to 2000. A form has a button that executes a Docmd.Domenuitem command. This is supposed to invoke Find and Replace. It does, but the subject is grayed out. I need the find to be based on the control where the cursor was when the button was pressed. Any ideas? Access help in 2000 does not even mention this command neither does my Access book. Maybe you need to do Screen.PreviousControl.SetFocus DoCmd.RunCommand acCmdFind or DoCmd.FindRecord On Thu, 29 Sep 2005 13:43:03 -0700, "mscertified" <rupert@tigerlily.com> wrote: >I'm converti...

Is it true about DoCmd.SendObject
That DoCmd.SendObject will find your default Mail client? -- Thanks in advance for any help with this......Bob MS Access 2007 accdb Windows XP Home Edition Ver 5.1 Service Pack 3 "Bob Vance" <rjvance@ihug.co.nz> wrote in message news:u91TwlG3KHA.4964@TK2MSFTNGP05.phx.gbl... > That DoCmd.SendObject will find your default Mail client? > > -- > Thanks in advance for any help with this......Bob > MS Access 2007 accdb > Windows XP Home Edition Ver 5.1 Service Pack 3 > > It's true if your default Mail client is Outlook :~) ...

Retrieving query result in code
Hello. I need to use a count of records returned by a query in my form code. I can use an actual count of the records returned by a query or I can use the COUNT function, either way, but I need to get the result in code not on the form itself. If I use Docmd.Openquery or Docmd.Runsql is there some way to have the result i.e. a record count returned in the code? Or is there some other way? Robert Robert wrote: > Hello. > > I need to use a count of records returned by a query in my form code. > I can use an actual count of the records returned by a query or I can > ...

Publisher 2000 Deluxe
I'm using Microsoft Publisher 2000 Deluxe. Is it possible to place zip code bar codes on envelopes? If so how? Ace H <Ace H@discussions.microsoft.com> was very recently heard to utter: > I'm using Microsoft Publisher 2000 Deluxe. Is it possible to place > zip code bar codes on envelopes? If so how? An article: http://office.microsoft.com/en-us/assistance/HP011269721033.aspx -- Ed Bennett - MVP Microsoft Publisher Thanks for the quick response Ed. I read the link you posted. I am able to print zip code bar codes (either above or below the address) using my Co...

Delete a code
Hello How can I delete a code (same code to all sheets) which is inserted in 50 sheets in an excel file? Delete the code sheet by sheet or there is an alternative way more simple? Thanks in advance. I assume you mean VBA code. The more eligant way is not to have added it in the first place. I think you must of had some VBA in a sheet and copied it 50 times and now you don't want to distribute the code with you workbook. Next time only copy the sheet once. Delete the code, then copy it 50 times. ------------------------------- POSTED BEFORE RECEIVING A REPLY AFTER 6 ...

The Audit Trail Code cannot be assigned.
I am doing the data migration. After I use the integraion manager 8.0 to upload GL transactions and then post, I would like to correct them since errors are made. I think the GP8.0 cannot recognize them as GL transactions and consider them as subsidary ones. Thus I have to mark "Voiding/Correcting of Subsidiary Transactions" in order to choose that jounal to correct. Unfortunately, after I post the batch, they are sent to the batch recovery window with the error message "The Audit Trail Code cannot be assigned. Infomration is incomplete or missing" What should I do...

Select specific worksheets & copy
Hi All I've tried to write the following code to: - find worksheets in active workbook with "Planned" in cell A1, - then select all those worksheets and copy them into one new workbook - then format each sheet within the new workbook (e.g. select a named range & copy/paste values etc) The workbook and worksheet names are dynamic I'm sure I've got the "End If"'s / "Next" in the wrong place (this always confuses me) At the moment it copies the active worksheet (which does not have "Planned" in cell A1) and a blank new w...

Error Code 481
Hi, I have a file that loads a Userform when opened. This works fine on several computers but on others Excel fails and returns a message that Error Code 481 has occurred. This error refers to saving Excel as an HTML file yet I am not doing this. All machines are running the same version of Excel (2000). Any ideas please? Mickey All sorted, the machines that would not load are missing an MS Patch. I had to delete some gifs to make the userform run acorss all our machines. I believe that you can use bitmaps to overcome this issue, however bitmaps would make my workbook too large...

When I close a form with DoCmd.Close I get a parameter popup
This is a repost. I will try to explain the problem a little better than I did the last time. When I execute DoCmd.Close on one of my forms I get one of those little unknown parameter popups, the kind you get when there's something wrong with your query. But all I'm trying to do is close the form, not read any data. This popup appears to be gernerated by the row source query in a list box on the form. This row source query references another text box on the form and this appears to be what the popup is asking for. But there's a value in this text box. And why should th...

Error code 0x800ccc0e
I've tried setting up my WM account. My mail comes in from the SBC global account but I can send nothing out. Can anyone point me in the right direction? -- Indianspringer John The right direction first would be for you to post the complete error message which contains the 0x800ccc0E error code -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. http://www.microsoft.com/protect "John S" <JohnS@discussions.microsoft.com> wrote in message news:38EE9E7F-B38E-41E4-B517...

Error Code 0X800CCC0F
I'm running Windows Live Mail 2009 on Windows Vista 32 bit. Below is the error code message that is continually popping up. I have not been able to find any useful information to fix this problem. Can someone help me with this? .......................................................................................................................... Unable to send or receive messages for the Aol (doody11096) account. Header download for the 'Teco' folder did not complete. Your server has unexpectedly terminated the connection. Possible causes for this include server pr...

Help with "Form DoCmd.Open and DoCmd.Close
The following two lines of code is not operating correctly. Private Sub cmdChangeVendor1_Click() DoCmd.Close acForm, "Invoice by Market Reviewer" DoCmd.OpenForm "Selections Vendor and Reviewer", acNormal End Sub When I click on the cmdChangeVendor1 button, I expect the form "Invoice by Market Reviewer" to close and the form "Selections Vendor and Reviewer" to open. But that is not the result I get. The form "Invoice by Market Reviewer" closes but that is about it. Nothing else opens. I have two forms that behaves this way. I have ...

Query in code not working
I'm trying to do the following: Set rstQueryData = db.OpenRecordset("Select * from qryAllParticipants" & _ "Where DateRecieved >= #" & Me.txtBegin & "# and <= #" & Me.txtEnd & "#, dbOpenSnapshot") I have of course declared all the required variables. I never know where to put the #'s and the quotes etc. DateRecieved, txtbegin and end of course are date fields. aryAllParticipants has as it's criteria the two text boxes on a form and is an aggregate query with several Group by's and one Sum field. Al...

Comments on code signing
Folks So I purchased a digital code signing certificate. $99 USD per year at https://secure.ksoftware.net/code_signing.html Once I got the certificate I spent an hour and a half searching and searching for the right tool. At first I was looking for codesign and then was looking for signcode. I ended up with about 20 browser windows open. Finally I somehow realized that what I needed was signtool. Which was somehow already installed on my system and had a wizard.. And the VB6 exe was signed in about 5 mouse clicks. <sigh> I tested it in a cleanish Virtual PC sessio...

Code Syntax
Will someone check my code and correct it? Please? I am deleting the current record on a form; key field is text type. I know the following is missing apostrophe/quotes but I haven't figured how that works. DoCmd.RunSQL "DELETE [tbl 1 Client].* FROM [tbl 1 Client] Where [tbl 1 Client].ClientID = & Me.ClientID" Also, is there a source to educate me on how to correctly code like this example where the item may be text or number? I have Access 2007 and am very frustrated by some changes in their help. Not used to is yet. -- Thanks for your help, Chris Chris wrote...

Simple VBA code failure
Hey gang, Guess who's back! I finally broke down and bought Office 2007 (not sure why though)! One of my games is not working correctly and I have no idea why. I have very simple code that hides text boxes, then shows them when needed using VBA. One of the objects shows up but the other one doesn't. Yes, I verified the names of the shapes. I've used this in PPT 2003 for years with no problems. If I go out of Slide Show mode, the text boxes the didn't show up are visible. Is this some sort of known bug with PPT 2007? Any ideas? They are simple text bo...