add varible name to macro

rainbows

Registered User.
Local time
Today, 01:58
Joined
Apr 21, 2017
Messages
428
i would like to be able to put the suppliers contact name in this macro but i dont know where to locate ir


1668597877815.png




1668598055010.png

i would to be able to say for example "paul" please find attached NCR


thanks
steve
 
I don't use macros. But do you have the 'Supplier Contact's first name" somewhere in your table?
You might be able to concatenate the First name and your "subject".
Definitely untested --just a thought regarding possible approach.
 
1668611925477.png



1668612034348.png

this shows the firstname in the suppliers table and the NCR detailsi would send
 
Using macros, I would recommend using the Set LocalVar action to store the value in a local variable first, so you can then concatenate it into the email message.
 
I don't use macros either. But I think TempVars were introduced especially for them.
 
i managed to get snippest from posts on here and managed to do it like this

thanks for your help

steve







Code:
Private Sub cmdEmailCustomer_Click()
 Dim strTo As String
    Dim strSubject As String
    Dim strMessageText As String
    
    Me.Dirty = False
    strTo = Me.[E-Mail address1]
    
    strSubject = " NCR Number " & Me.[loss order number]
    strMessageText = Me.Firstname & "," & _
        vbNewLine & vbNewLine & _
        "Please See Attached NCR." & _
        vbNewLine & vbNewLine & _
        ""


    DoCmd.SendObject ObjectType:=acSendReport, _
        ObjectName:="SEND NCR", _
        OutputFormat:=acFormatPDF, _
        TO:=strTo, _
        Subject:=strSubject, _
        messageText:=strMessageText, _
        EditMessage:=True
End Sub
 

Users who are viewing this thread

Back
Top Bottom