473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Compile Error: Argument not optional when trying to create an email

anoble1
245 128KB
I have some code that jumps here below and just stops at "GeneralEmail" and gives that Argument not Optional Error.
Expand|Select|Wrap|Line Numbers
  1. GenerateEmail "anoble@******.com", ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " - Starting " & Forms!frmCrewAuthorization!AuthDate.Value, Forms!frmCrewAuthorization!Name.Value & "'s Crew" & vbCrLf & vbCrLf, outFileName, False
Then I have a module. Wonder if this works with my Office 2013? But I have Access 2007.
Expand|Select|Wrap|Line Numbers
  1. Public Function GenerateEmail(mailTo As String, mailCc As String, mailBcc As String, subject As String, body As String, attachment() As String, autoSend As Boolean)
  2.  
  3.     Set MyOutlook = New Outlook.Application
  4.     Set MyMail = MyOutlook.CreateItem(olMailItem)
  5.  
  6.     i = 0
  7.     While i <= UBound(attachment)
  8.         MyMail.Attachments.Add attachment(i)
  9.         i = i + 1
  10.     Wend
  11.  
  12.     MyMail.To = mailTo
  13.     MyMail.CC = mailCc
  14.     MyMail.BCC = mailBcc
  15.  
  16.     MyMail.subject = subject
  17.     MyMail.body = body
  18.  
  19.     If autoSend Then
  20.         MyMail.Send
  21.     Else
  22.         MyMail.Display
  23.     End If
  24.  
  25.  
  26.  
  27.     Set MyMail = Nothing
  28.     Set MyOutlook = Nothing
  29.  
  30. End Function
  31.  
Feb 13 '15 #1
1 1711
jforbes
1,107 Expert 1GB
First thing I see is that you are attempting to pass:
Expand|Select|Wrap|Line Numbers
  1. ContractorName.Value & " Crew Authorization " & cmbContractID.Column(1, cmbContractID.ListIndex) & "-" & AuthNum.Value & " - Starting " & Forms!frmCrewAuthorization!AuthDate.Value
into the "mailCc As String" parameter. I doubt that is right.
Feb 13 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bobbak | last post by:
Hello All, I could really use some help with this bit of code I am working on, every time I come to execute it I get an error that says "Compile Error: Argument not optional". Now I am using...
0
by: MLH | last post by:
In Access 97, I run the following command... DBEngine.CompactDatabase FullPathNfilename, "c:\MyDir\tocodata.sys", DB_LANG_GENERAL Error 3356 "You attempted to open a dtaabase that is already...
3
by: Peter | last post by:
Hi, I am trying to compile an existing project (originally c) in .NET (rename .c files to .cpp). After fixing some problems, here are the ones that I don't know how to deal with:...
1
by: יוני גולדברג | last post by:
Hi, While trying to create new directory i recieve the following error message: "System.IO.DirectoryNotFoundException: Could not find a part of the path "\\premfs16\sites". The path exists, even...
5
by: TonyJ | last post by:
Hello! I get compile when using VS2005 but not in VS2003. The compile error is the following "Error 1 error C3867: 'MeltPracCommon::ReasonDialog::tbReason_TextChanged': function call missing...
0
by: ppletkov | last post by:
Hi - I apologize if this is a simple question in advance :-) (hopefully it is so its quickly resolved!) i'm trying to figure out why i keep getting an error (Compile Error : expected function or...
0
by: fredlexus | last post by:
Hi, Scenario: Click on button and timeline animation plays (the animation is a panel that rotates from the back to the front ) AS - 3.0 CS5 Error: Scene 1, Layer 'actions', Frame 1, Line...
2
Seth Schrock
by: Seth Schrock | last post by:
I have a main form that has two subforms. In the main form's OnLoad event I have code that references both subforms to set their allow additions, edits, and deletions to true or false depending on...
12
Seth Schrock
by: Seth Schrock | last post by:
I have a search form that allows the user to type in a customer name and it brings up all the records that are like the name the user typed in. The user then just double clicks on the record and it...
3
by: adamnorsworthy | last post by:
I have a query called 'Query1' and it uses the following SQL: SELECT DISTINCT nps.Agent , nps. , (Select Count(*) from Where < .) AS Rank FROM
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.