Problem with email code

sha7jpm

Registered User.
Local time
Today, 09:41
Joined
Aug 16, 2002
Messages
205
Hi,

I am having a problem with my email code. I have up to 10 different projects which are included onto the bulk of the email message. I previously had 10 forms which populated a final form.
the code below then grabbed the data from each txtbox.

that was quite clumsy though, so I now have a table which houses the 10 lines of data. the form picks all this up perfectly. but the code below only grabs the first line..
is there a way to make the code pick up the data for all 10 lines?

let me know if I am sounding very confused!

thanks
John.


Option Compare Database
Option Explicit

Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim strTextMessage As String
strTextMessage = "DATA ENTRY FOR THE FOLLOWING INSTRUMENTS HAS NOW BEEN COMPLETED" & Chr(13)
strTextMessage = strTextMessage & Chr(13)
strTextMessage = strTextMessage & Me!txt1a & " - " & Me!txt1d & Chr(13)
strTextMessage = strTextMessage & Chr(13)
strTextMessage = strTextMessage & fIsBlank(Me.Instruments___Quantity, 1, Chr(13))
strTextMessage = strTextMessage & fIsBlank(Me.SNAP_FileName, 2, Chr(13))
strTextMessage = strTextMessage & fIsBlank(Me.Project_Phase, 4, Chr(13))
strTextMessage = strTextMessage & fIsBlank(Me.Actual_inst_quantity_keyed, 3, Chr(13))

DoCmd.SendObject acSendNoObject, , , Me!txtemailaddressCC, Me!NfER1, , "Project Code " & Me!txt1a, strTextMessage, True

Exit_Command10_Click:
Exit Sub

Err_Command10_Click:
msgbox "You have chosen to not send this email"
Resume Exit_Command10_Click

End Sub
 
If each Line is a Seperate Record you will need to loop through the recordsetclone of the form to retrieve all of the items. This will mean changing your code to reference the the RecordSetClone objects fields and not the Forms Controls.
 

Users who are viewing this thread

Back
Top Bottom