Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only include filled-in lines of sending e-mail using Outlook

Status
Not open for further replies.

acnovice

Programmer
Jan 27, 2005
100
US
I have a command button to send E-mail using Outlook from Access form.

Question: I want to include only lines filled in.
Following is a part of my code, it includes all of lines in the form.

Example) Sometimes, we do have Output Type and Output Volt but sometimes don't.

Private Sub send_Email_Click()
On Error GoTo Err_send_Email_Click

Dim objOutlook As Outlook.Application
Dim objFolder As Outlook.MAPIFolder
Dim strBody As String

Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
objEmail.Display

Select Case clkInclude
Case Is = -1 'Checked
Select Case clkGreeting
Case Is = -1 'Checked
strBody = strBody & "Inquiry No.: " & "Q" & QNo & Chr(13) & Chr(13)
strBody = strBody & "1. Quantities for your quote: " & SIsquoteqty & Chr(13) & Chr(13)
strBody = strBody & "2. Specification Required: " & Chr(13)
strBody = strBody & " Form Factor: " & ProducType & Chr(13)
strBody = strBody & " Input: " & InpuType & Chr(13)
strBody = strBody & " Total Watts: " & TotalWatt & "W" & Chr(13)
strBody = strBody & " Output Type: " & OutputType & Chr(13)
strBody = strBody & " Output Volt: " & OutputVolt & Chr(13)

...................
 
Have a look at the If instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Are you asking if something has been checked or not, or if a field has been filled?

I imagine a checkbox is obvious?


For a field, several ways...

If Not IsNull(txtField) Then

If Len(txtField) <> 0 Then

If txtField & "" <> "" Then 'both null & empty strings
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top