Leo_Polla_Psemata
Registered User.
- Local time
- Today, 07:40
- Joined
- Mar 24, 2014
- Messages
- 364
Code:
Private Sub Report_Current()
Dim RsEmail as dao.recordset
set RsEmail = currentdb.openrecordset ("your table name")
With rsEmail
sMessageBody = "Email body Text"
Do Until .EOF
sMessageBody = sMessageBody & vbCrLf & .Fields(POL) & " " & .Fields(POD) & "" & .Fields(RATE20) & "" & .Fields(RATE40)
.MoveNext
Loop
DoCmd.SendObject , , , , , , "test test", sMessageBody, True, ""
End With
End Sub
Hi, I need your help, I am not programmer, nor IT , just one clerk who enjoy access and I have solved too many problems in my daily job.
I have used the above code successfully and I compose outlook emails,
on the email body I display many rows as per table or query ("your table name").
Now, i want to do the same but , the query ("your query name") is a =Forms!FormName.Text1 type
and the code asks for parameters. It doesn't work.
I try to copy my query as recordset as per below example.
I transfer the whole sql syntax correctly , the "Where" is also there.
strSQL = "SELECT FrRef.ID, FrRef.frref, FrRef.effective, FrRef.expire, Tbl_Oferta.ID, Tbl_Oferta.ClientCode, " _
& "sql copy paste, no need to display the entire query , " _
& "WHERE (((FrRef.frref)=[forms]![frm_frrefoferta]![frref]) AND ((Tbl_Oferta.ClientCode)=[Forms]![Frm_FrRefOferta]![Tbl_Oferta].[form]![ClientCode])); "
I don't know how to make the
set RsEmail = currentdb.openrecordset ("your table/query name")
work like this
set RsEmail = currentdb.openrecordset ("run this strsql")
The syntax of the whole code