Sendobject with Dlookup

dark11984

Registered User.
Local time
Tomorrow, 05:21
Joined
Mar 3, 2008
Messages
129
Please help... I've never used Dlookup before and i'm not quite sure what i'm doing.

I have a form where you enter details for a quotation to give to sales.
You select a salesperson from a combobox and upon pushing a button i want to be able to send the quotation report to that particular salesperson. This is what i've got so far.

Private Sub Command55_Click()
Dim stDocName As String
Dim stToName As String
Dim stCCName As String
Dim stSubject As String
Dim stMessage As String

stDocName = "QuotationReport"
stToName = DLookup("", "employeetable", [EmployeeTable].[EmployeeID] = [EquiriesMainTable].[EMPLOYEE ID]) [COLOR=red]I'm not quite sure what goes here?[/COLOR]
stCCName = "ABCD[EMAIL="ABCD@ABCD.com"]@ABCD.com
"
stSubject = "Quotation Test"
stMessage = "Attached is a self generated purchasing quotation. This is a test."
DoCmd.SendObject acSendReport, stDocName, acFormatSNP, stToName, stCCName, stSubject, stMessage

End Sub

Thanks
 
Howzit

You can try the below if bound value is a string

Code:
stToName = DLookup("[email]", "employeetable", "[EmployeeID] = '" & me.yoursalespersoncombobox & "'")

or if the bound value of your salespersoncontrol is a value

Code:
stToName = DLookup("[email]", "employeetable", "[EmployeeID] = " & me.yoursalespersoncombobox)
 
Thanks!! The bound value code worked great!!!
 

Users who are viewing this thread

Back
Top Bottom