SendObject acXXXXXX use of varibles

  • Thread starter Thread starter DDBeards
  • Start date Start date
D

DDBeards

Hello again, I am using a the following command in sub to send out emails.
What I wish to do however is to create varibles so I can either use
"acSendReport" or "acSendNoObject". I would like a second varible to do the
same with the "acFormatsnp" or "". I tried it with by defining the varibles
as:
dim strType as string 'ObjectType
dim strTypeForm as string 'OutputFormat

Working CODE: DoCmd.SendObject acSendReport, "frmtest", acformatsnp,
strToWhom, strCCWhom, , strSubject, strMsgBody, True

Desired Code: DoCmd.SendObject strType, "frmtest", strTypeForm, strToWhom,
strCCWhom, , strSubject, strMsgBody, True

I am sure my problem is with the DIM statments, but can someone please tell
me a way to solve this one. Thanks
 
DDBeards said:
Hello again, I am using a the following command in sub to send out emails.
What I wish to do however is to create varibles so I can either use
"acSendReport" or "acSendNoObject". I would like a second varible to do
the
same with the "acFormatsnp" or "". I tried it with by defining the
varibles
as:
dim strType as string 'ObjectType
dim strTypeForm as string 'OutputFormat

Working CODE: DoCmd.SendObject acSendReport, "frmtest", acformatsnp,
strToWhom, strCCWhom, , strSubject, strMsgBody, True

Desired Code: DoCmd.SendObject strType, "frmtest", strTypeForm, strToWhom,
strCCWhom, , strSubject, strMsgBody, True

I am sure my problem is with the DIM statments, but can someone please
tell
me a way to solve this one. Thanks


The constants acSendReport, acSendNoObject, etc., are integer values
(membersof what is called an "enumerated type"), so the variable you use to
hold them should be declared as an Integer:

Dim intType As Integer

The format-type constants, such as acFormatSNP, are string constants, so
your declaration of strTypeForm as String is correct. Here's example code:

Dim intType As Integer
Dim strTypeForm As String

intType = acSendReport
strTypeForm = acFormatSnp

DoCmd.SendObject intType, "frmtest", strTypeForm, _
strToWhom, strCCWhom, , strSubject, strMsgBody, True
 
Thank you sir, it works great!

Dirk Goldgar said:
The constants acSendReport, acSendNoObject, etc., are integer values
(membersof what is called an "enumerated type"), so the variable you use to
hold them should be declared as an Integer:

Dim intType As Integer

The format-type constants, such as acFormatSNP, are string constants, so
your declaration of strTypeForm as String is correct. Here's example code:

Dim intType As Integer
Dim strTypeForm As String

intType = acSendReport
strTypeForm = acFormatSnp

DoCmd.SendObject intType, "frmtest", strTypeForm, _
strToWhom, strCCWhom, , strSubject, strMsgBody, True



--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top